angela-d / prtg-zendesk-webhook

Automate ticket creation when PRTG sensors are triggered, to easily delegate IT tasks.
GNU General Public License v2.0
2 stars 1 forks source link

Only receiving updates, not notified of new issues #1

Closed diiickie closed 4 years ago

diiickie commented 4 years ago

I have installed this but am only receiving a notification/ticket creation once the status is Up. I do not get a ticket created when the sensor is down.

angela-d commented 4 years ago

Did you set a threshold?

On the Zendesk device in PRTG:

diiickie commented 4 years ago

I don't have a Zendesk device setup as I didn't see this in any of the setup documentation.

Can you advise how I set this up or a link to somewhere I can take a look please?

angela-d commented 4 years ago

Did you follow the steps under the How to Use It section? (from the readme)

diiickie commented 4 years ago

Yes, I have:

Added ZendeskWebhook.ps1, configured with login and API token etc Configured PRTG Execute Program notification with parameters I have assigned the notification to a group.

PRTG and Zendesk must be talking successfully as I get ticket creations when devices are 'Up' just nothing when they first go Down.

angela-d commented 4 years ago

Oh I see, so you're getting a flurry of 'up' tickets, instead of 'Down' ones. Disregard my earlier message with the screenshot - was a different Zendesk script I was mistakenly referring to. :)

These two steps are what I'd focus on:

I'm suspecting the Notification Trigger is the problem.

Here's mine, for the "Printers" group: printers

This opens a ticket only when a device inside the Printers group has a Down status after the specified timeframe is met.

diiickie commented 4 years ago

That still doesn’t appear to be working.

No down alerts come through.

On Mon, 6 Apr 2020 at 23:56, Angela notifications@github.com wrote:

Oh I see, so you're getting a flurry of 'up' tickets, instead of 'Down' ones. Disregard my earlier message with the screenshot - was a different Zendesk script I was mistakenly referring to. :)

These two steps are what I'd focus on:

  • 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

I'm suspecting the Notification Trigger is the problem.

Here's mine, for the "Printers" group: [image: printers] https://user-images.githubusercontent.com/33108490/78612709-a24d6a80-782f-11ea-9ecf-0f30594d00a5.png

This opens a ticket only when a device inside the Printers group has a Down status after the specified timeframe is met.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/angela-d/prtg-zendesk-webhook/issues/1#issuecomment-610078581, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKTIHUYJCLR37G44DCGGRIDRLJMZJANCNFSM4MCHNDJQ .

-- Sent via mobile on the move. Please excuse any typos.

angela-d commented 4 years ago

Can you explain your device/sensor setup and provide screenshots?

TimHirs commented 4 years ago

Hi,

I have exactly the same issue, I am just getting UP messages, no DOWN messages. In the PRTG log I found following error message:

Error sending "EXE": Error1. ICMP : The term 'ICMP' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:203 + ... Points' [...] (Sensor/Source/ID: 6401/4193/2)

Many thanks for help!

angela-d commented 4 years ago

@TimHirs Where are you seeing this message? In PRTG or Zendesk?

Error sending "EXE": Error1. ICMP : The term 'ICMP' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:203 + ... Points' [...] (Sensor/Source/ID: 6401/4193/2)

Can you also explain your setup and provide screenshots?

TimHirs commented 4 years ago

Hi angela-d, thanks for the quick reply. The setup is quite simple, I am running just a ping sensor on one of our devices. If the device gets DOWN, I can see the error message I mentioned in the PRTG log: Error The result is that nothing was sent over to Zendesk --> no ticket created

If the device is UP again, the log file in PRTG shows: OK The result is a ticket that has been created in Zendesk.

It would be great ti have this ticket when the device gets DOWN.

Many many thanks for your efforts

angela-d commented 4 years ago

Please post the following:

Unless I am looking at your first screenshot wrong, it looks like the script was triggered on the Down sensor, but because of a conflict yet to be determined, failed.

This is my environment:

Am I correct in understanding the 'Ok' trigger writes to the ticket, as expected?

The error you receive during the Down sensor, from PRTG:

The term 'code:' is not recognized as the name of a cmdlet, function, script file, or operable program.

Seems like a coding error, but I can't say I've ever seen this in my PRTG instance, so that is why I'm thinking it may be related to a Powershell version difference.

code: is also not referenced anywhere within this script, as well.

TimHirs commented 4 years ago

Hello,

Version of PowerShell: Major Minor Build Revision


5 1 14393 206

PRTG-Version 20.1.55.1775+

the OK-trigger writes the ticket in Zendesk as expected, the DOWN trigger not.

Thanks.

angela-d commented 4 years ago

Can you turn debug on and trigger a down sensor and post anything that's seen? (open the script and set: $debug = 0 to $debug = 1)

Also, are you using the down simulation or are these actual live 'down' sensors?

TimHirs commented 4 years ago

Turned on debug, but no output when a down sensor has been triggered. When device is back up, then a log file is created (OK) I am using live DOWN sensors, not the simulation.

angela-d commented 4 years ago

The script isn't executing at all, when the down sensors are hit, it sounds like.

What version of PRTG are you on? Edit: just scrolled up and seen. That's much newer of a version than this script originally ran on (I'm also on 20+) so that is definitely not the issue.

Can you modify the triggers and set the notifications to 'Up'? I presume you have them set to 'Down' right now, so I want to see what happens when you reverse it, since it's working when the sensors come back online.

TimHirs commented 4 years ago

I´ve modified the triggers and set the notifications to "UP". Procedure I have followed:

Result : The ticket has been created in Zendesk.

It seems to be an issue just with the DOWN state.

angela-d commented 4 years ago

I was able to reproduce this, finally!

It took a bit of digging - but it appears to be related to a subject that has a space in the $Message variable. Something like: Devicename and color and not Devicename

I suspect something changed in PRTG during one of the updates.

Here's what happened:

I vaguely remember doing battle with this same issue, now.

How to fix

Modify your notification template that talks to Zendesk.

Change it to:

-Device '%device' -Status '%status' -Down '%down' -Group '%group' -commentssensor '%commentssensor' -CommentsProbe '%commentsprobe' -Message '%message'

Please test and report back if that fixes it? If so, I'll update the install instructions (unless you'd like to, of course.)

TimHirs commented 4 years ago

Many many thanks, this has worked for me 👍 Happy to say that this has fixed the issue.

diiickie commented 4 years ago

I can also confirm this has made PRTG effectively report the down alert to Zendesk.

It did not however close the ticket after the sensor was 'Up'.

TimHirs commented 4 years ago

@diiickie ; same for me, but I also don´t want to close the ticket automatically when the sensor is UP again. Most time there is a reason why the sensor was down, that needs to be investigated in my infrastructure, so I am happy that the script just updated the ticket.

diiickie commented 4 years ago

@TimHirs Mine didn't update the ticket though it just created another which is even worse than email alerts which I currently merge as it doesn't carry the same level of info.

angela-d commented 4 years ago

@diiickie Auto-closure of tickets was never built into this, you could certainly extend it to do so, but it wasn't a feature I needed - so it didn't get added.

After a device is down, I still want someone to physically check it, so closing them wouldn't work, in that regard.

@TimHirs explained pretty well against, too.

If you're getting duplicate tickets, you didn't close or delete the old ones. There is a search function within the existing code base that will see if a matching ticket exists. If the content doesn't match, it'll open a new one.

If you're seeing it for multiple sensor tickets per device, you would want to set a dependency in the settings, so the child sensors get paused if the parent sensor (dependency) has a down status.