Search code examples
phpnagios

Read Nagios Notification using php


How can I read response from a remote server using Nagios Notification? I'm new to this Nagios Notification System. The only data from the server side is, they are pushing data in this format:

/usr/bin/curl --url http://mywebpage.com/TicKeTREder.php? --data-urlencode "eventType=Nagios Notification" --data-urlencode "message=$NOTIFICATIONTYPE$#$LONGDATETIME$#$SERVICEDESC$#$HOSTALIAS$#$SERVICESTATE$#$SERVICEOUTPUT$#$CONTACTEMAIL$#$NOTIFICATIONISESCALATED$"

I've tried searching. But no results found.

What I need is read those tickets from Nagios notification system with my TicKeTREder.php page.

Is there any plugin to read these data using php.

Issue solved since the problem was not with the program side.


Solution

  • You get the message with

    $message = $_REQUEST['message'];
    

    You can split the information parts with:

    $infoArray = explode('#', $message);
    

    Then $infoArray[0] holds the notification type and so on.