Automatically open Zendesk tickets for triggered sensors using Powershell. Forked from Integrating Zendesk and PRTG
Before:
Error by lookup value
After:
Critical (2) in channel Imaging Unit (Magenta)
.. if additional triggers from the same sensor, a newline to easily list the problems
Main Features:
This version has additional features:
C:\Program Files (x86)\PRTG Network Monitor\Notifications\EXE
(your path may vary if using a different architecture with your PRTG server)Zendeskwebhook.ps1
-Device '%device' -Status '%status' -Down '%down' -Group '%group' -commentssensor '%commentssensor' -CommentsProbe '%commentsprobe' -Message '%message'
If you'd like to add additional verbiage to your tickets, you can call additional parameters in similar fashion to the existing parameters.
(Don't forget to add them to params() to initialize inside ZendeskWebhook.ps1
)
(optional) Update Existing Tickets
$updateExisting
variable to 1
2) You can customize "update" messages by modifying the following:
# Update existing ticket or create new
if ($existingNewTickets -gt 0 -and $updateExisting -eq 1) {
# there is at least one open ticket for this device tagged with PRTG
$Ticket = $SearchResults.results.Item(0)
Write-Host "Found a ticket! Updating ticket #$($Ticket.id)"
$Transaction = @{
ticket = @{
comment = @{
public = $false;
body = $CommentBody;
author_id = $AuthorId;
}
}
}
...
public = $false;
= Whether or not you want the reply to be a public reply, or just for agentsbody = $CommentBody;
= If you want a custom reply, set your own message (or variable) here, otherwise, it'll re-post the initial messageauthor_id = $AuthorId;
= If you want to change the follow-up reply author, modify that here, otherwise, the initial poster will be the reply authorIf you prefer to use password authentication with Zendesk instead of token auth (the default), simply remove '/token' from the username.
Error by lookup value 'Critical (1)' in channel 'Toner (Yellow)'
- modify your contact template to have double-quotes over the -Message parameter, like so:
-Message "%lastmessage"
instead of
-Message '%lastmessage'
Tietze's release is unlicensed/public domain; my changes are licensed under GPL2