简体   繁体   English

使用php阅读Nagios Notification

[英]Read Nagios Notification using php

How can I read response from a remote server using Nagios Notification? 如何使用Nagios Notification从远程服务器读取响应? I'm new to this Nagios Notification System. 我是这个Nagios通知系统的新手。 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. 我需要的是在TicKeTREder.php页面上从Nagios通知系统中读取那些票证。

Is there any plugin to read these data using php. 是否有任何插件可以使用php读取这些数据。

Issue solved since the problem was not with the program side. 解决了问题,因为问题不在程序端。

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. 然后$infoArray[0]保存通知类型,依此类推。

you will get data from nagios as a string where all the server /service details are seprated with hash(#). 您将从nagios以字符串形式获取数据,其中所有服务器/服务详细信息均用hash(#)分隔。 You can split these details by : 您可以按以下方式拆分这些详细信息:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM