Giter Site home page Giter Site logo

angela-d / prtg-zendesk-webhook Goto Github PK

View Code? Open in Web Editor NEW
2.0 4.0 1.0 155 KB

Automate ticket creation when PRTG sensors are triggered, to easily delegate IT tasks.

License: GNU General Public License v2.0

PowerShell 100.00%
prtg prtg-sensors prtg-network-monitor zendesk zendesk-api powershell zendesk-tickets

prtg-zendesk-webhook's Introduction

PRTG Zendesk Tickets Webhook

Automatically open Zendesk tickets for triggered sensors using Powershell. Forked from Integrating Zendesk and PRTG

Zendesk Tickets

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:

  • Automatically open Zendesk tickets when a sensor is triggered; useful for IT Staff to automate delegation to tech assistants
  • Update/reopen existing tickets for the same sensor

This version has additional features:

  • Tokenized authentication, to keep your password secure
  • Secure API connections over TLS 1.2
  • Fixes the single quote bug when using Powershell
  • Option to update existing open/new tickets
  • Local logging option for debugging when testing sensor messages
  • A bit more newb friendly
  • Formatting cleanup

PRTG Parameters

How to use it

  • First, clone/copy ZendeskWebhook.ps1 to: C:\Program Files (x86)\PRTG Network Monitor\Notifications\EXE (your path may vary if using a different architecture with your PRTG server)
  • Open ZendeskWebhook.ps1 and add your config (Zendesk credentials, log options, etc; use your API token as the password)
  • Login to your PRTG dashboard
  • Setup > Account Settings > Notification Templates
  • Add/click on the template you want to use with this script
  • Populate the settings as you wish, then scroll toward the bottom for the Execute Program toggle; click it
  • In the Program File field, select Zendeskwebhook.ps1
  • In the Parameters field, add the following:
-Device '%device' -Status '%status' -Down '%down' -Group '%group' -commentssensor '%commentssensor' -CommentsProbe '%commentsprobe' -Message '%message'
  • In the search field (upper right corner), search for the sensor Group you'd like to use this script with
  • Under the group list, click it > Notification Triggers > Add/edit the trigger you wish to use with this script and select the notification template you assigned the script to earlier
  • Save and trigger a sensor that's using the template to test!

Customizing

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

    1. Set the $updateExisting variable to 1
    1. 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 agents
    • body = $CommentBody; = If you want a custom reply, set your own message (or variable) here, otherwise, it'll re-post the initial message
    • author_id = $AuthorId; = If you want to change the follow-up reply author, modify that here, otherwise, the initial poster will be the reply author

Password Auth over Token Authorization

If you prefer to use password authentication with Zendesk instead of token auth (the default), simply remove '/token' from the username.

Troubleshooting

  • Auto-closure of tickets after a device returns to Up/OK is not a feature, at this time. If this is something you need, you'll have to extend the codebase.
  • If you aren't getting tickets opened for messages that have single quotes: 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'
    

License

Tietze's release is unlicensed/public domain; my changes are licensed under GPL2

prtg-zendesk-webhook's People

Contributors

angela-d avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

diiickie

prtg-zendesk-webhook's Issues

Missing dependencies...

Please update the README.MD with the required libraries.
Preferably with links / statements to install.

In particular:
"Call-ZenDesk "/api/v2/tickets.json" Post $Body"

Where is "Call-ZenDesk"
Thanks
JR

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.