asuknath / Nagios-Status-JSON

Nagios Status JSON
26 stars 19 forks source link

Push Notifications not working #7

Closed shanemarsh28 closed 6 years ago

shanemarsh28 commented 6 years ago

Hi, Is your Push Notifications API working?

I have followed your readme to the letter and Nagios appears to be executing ServerAlarmsNotify.php correctly. I have tested the script manually and found that it was requesting a URL like this:

https://serveralarms.com/fcm/api.php?tag=send&title=%3A%3ADOWN%3A%3A+<NAME>&groupname=9VA6F-64STA-URTV2-XXXX&mess=HOST+-+<NAME>+is+DOWN

I have visited: https://serveralarms.com/fcm/api.php and the API does seem to be online and the above does not return an error but sadly, I receive no push notification.

Am I missing something? (Sensitive data omitted)

shanemarsh28 commented 6 years ago

Anyone?

Please advise if this app is no longer being maintained.

asuknath commented 6 years ago

Hi Shane,

Are you using iPhone or Android?

Did you follow GitHub's Guide? https://github.com/asuknath/Nagios-Status-JSON

Push notification is working. I can help you to configure Push Notification.

Thank You, Asuk Nath

On Thu, Jan 11, 2018 at 1:32 PM, Shane Marsh notifications@github.com wrote:

Anyone?

Please advise if this app is no longer being maintained.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/asuknath/Nagios-Status-JSON/issues/7#issuecomment-357019249, or mute the thread https://github.com/notifications/unsubscribe-auth/ATdgqW38iNnMRQrDkwMmNlHvtl5YyuhJks5tJlO6gaJpZM4RN5gn .

shanemarsh28 commented 6 years ago

Hi Asuk,

Thank you for getting back to me.

Yes I followed your setup guide to the letter and the notification is getting executed server side correctly and I'm on Android.

If it helps, even if I run the code manually (on our Nagios Server, as mentioned above) I still do not receive a push notification on my phone. I can confirm the Group API key (from the app) matches that of the config I have in Nagios and the app is fully logged in - I can see the status of all services from the app.

Shane

asuknath commented 6 years ago

Just to make sure your config is good please follow following steps:

  1. Edit /usr/local/nagios/etc/objects/commands.cfg and add following lines. Replace xxxx with your GROUP API KEY. You will find GROUP API KEY in the App under Menu--> Settings.

'sm-host-push-notify' command definition

define command{ command_name sm-host-push-notify command_line /usr/local/nagios/libexec/ServerAlarmNotify.php $HOSTNAME$ xxxxx-xxxxx-xxxxx-xxxxx HOST $HOSTSTATE$ }

'sm-service-push-notify' command definition

define command{ command_name sm-service-push-notify command_line /usr/local/nagios/libexec/ServerAlarmNotify.php $HOSTNAME$ xxxxx-xxxxx-xxxxx-xxxxx SERVICE $SERVICESTATE$ }

  1. Download ServerAlarmNotify.php from Github and upload to /usr/local/nagios/libexec/

  2. Make ServerAlarmNotify.php executable using following command

    chmod +x ServerAlarmNotify.php

  3. Manually test push notification

    ./ServerAlarmNotify.php $HOSTNAME$ xxxxx-xxxxx-xxxxx-xxxxx

    SERVICE $SERVICESTATE$

On Thu, Jan 11, 2018 at 2:10 PM, Shane Marsh notifications@github.com wrote:

Hi Asuk,

Thank you for getting back to me.

Yes I followed your setup guide to the letter and the notification is getting executed server side correctly and I'm on Android.

If it helps, even if I run the code manually (on our Nagios Server, as mentioned above) I still do not receive a push notification on my phone. I can confirm the Group API key (from the app) matches that of the config I have in Nagios and the app is fully logged in - I can see the status of all services from the app.

Shane

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

shanemarsh28 commented 6 years ago

Hi Asuk,

Thank you for looking into this - I received your test notification. After replacing the code as per your instructions it still didn't work but then I looked more closely at the API Key!

In the last quadrant I typed 0 rather than O. I feel so silly. Notifications are now working as expected!

The only small thing I see is when I view the Hosts and services in the app, the time Last Checked and Next Check times are four hours behind? At the moment for one of the hosts I have a next check time of: 01/11/2018 04:21:58PM!

Is there anyway to set the correct timezone?

Thank you for your help!

Shane

asuknath commented 6 years ago

Shane,

API file (nath_status.php) returns JSON output from Nagios's status.dat file. status.dat keeps all dates/times using UNIX Time Stamp.

Right now EST timezone is hard coded in the App.

I will add this in my to do list and try to adjust it.

Going to release an update soon.

Asuk

On Thu, Jan 11, 2018 at 4:23 PM, Shane Marsh notifications@github.com wrote:

Hi Asuk,

Thank you for looking into this - I received your test notification. After replacing the code as per your instructions it still didn't work but then I looked more closely at the API Key!

In the last quadrant I typed 0 rather than O. I feel so silly. Notifications are now working as expected!

The only small thing I see is when I view the Hosts and services in the app, the time Last Checked and Next Check times are four hours behind? At the moment for one of the hosts I have a next check time of: 01/11/2018 04:21:58PM!

Is there anyway to set the correct timezone?

Thank you for your help!

Shane

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/asuknath/Nagios-Status-JSON/issues/7#issuecomment-357065574, or mute the thread https://github.com/notifications/unsubscribe-auth/ATdgqetX3Eau_KD3C9ol6hQEafd-RUl7ks5tJnu2gaJpZM4RN5gn .

shanemarsh28 commented 6 years ago

Excellent!

Again thank you! I'll look forward to your update.

Shane

shanemarsh28 commented 6 years ago

Thank you for updating the time zones within the app today. Much appreciated :)

Shane

breeze4uhk commented 7 months ago

my group api key in iOS only shows "00000-00000-00000-00000-00000", please help