Nagios Status JSON
This PHP API script reads Nagios status.dat file and return the JSON result. This API is desinged for Nagios Client unofficial Nagios status monitoring app.
Upload nath_status.php to your Nagios web root folder.
/usr/share/nagios/html/
/usr/local/nagios/share/
/usr/local/nagiosxi/html/
Edit nath_status.php. You can use your favourite text editor
vi /usr/local/nagios/share/nath_status.php
Change status.dat file's path according to your Nagios Server configuration.
$statusFile = '/usr/local/nagios/var/status.dat';
/var/log/nagios/status.dat
Use following command to find status.dat location.
find / -name status.dat
Download and Configure iPhone or Android Server Alarms Nagios Client
Go to settings
Update URL
(http or https)://nagiosserver_address/nagios/
(http or https)://nagiosserver_address/nagiosxi/
1 Download Script from following PHP Script File
2 Upload File to Nagios's Plugin Folder**
/usr/local/nagios/libexec/
3 Make ServerAlarmNotify.php file executable using following command.
chmod +x ServerAlarmNotify.php
4 Edit commands.cfg and add following two commands. You will find your under settings. Menu -> Setting.
# 'sm-host-push-notify' command definition
define command{
command_name sm-host-push-notify
command_line /usr/local/nagios/libexec/ServerAlarmNotify.php $HOSTNAME$ YOURGROUPKEY HOST $HOSTSTATE$
}
define command{ command_name sm-service-push-notify command_line /usr/local/nagios/libexec/ServerAlarmNotify.php $HOSTNAME$ YOURGROUPKEY SERVICE $SERVICESTATE$ }
#
- **5** Edit **templates.cfg** file. Modify Contact Templates and add **sm-service-push-notify** as service notification command and **sm-host-push-notify** as host notification command.
-
```javascript
define contact{
name generic-contact
service_notification_period 24x7
host_notification_period 24x7
service_notification_options c,r
host_notification_options d,r
service_notification_commands notify-service-by-email,sm-service-push-notify
host_notification_commands notify-host-by-email,sm-host-push-notify
register 0
}
#
6 Nagios Client Generates GROUP API KEY using Nagios URL
7 If your GROUP API KEY is not showing
For support contact support@serveralarms.com