由于最近将Nagios从3.X版本升级到了4.0.7,突然发现nagiosQL无法重启Naigos,查了很多资料都是没有能够解决,最后,终于在一个论坛中找到,只是不容易呀。
导致原因:因为nagiosql的重启消息格式还是3.x的,而4.x版本的nagios重启命令格式已经改变。
解决方法:
修改nagiosql的verify.php,使其$strCommandString = "[".mktime()."] RESTART_PROGRAM;".mktime(); 都更新为$strCommandString = "[".mktime()."] RESTART_PROGRAM\n";即可
Nagios反馈的信息是:
I have checked that. Nagios 4.0.0 has a command queue - this ist located by default:
/usr/local/nagios/var/rw/nagios.cmd
But the old NagiosQL command does not work with Nagios 4.0.0. So edit verify.php and modify line 345 from:
$strCommandString = "[".mktime()."] RESTART_PROGRAM;".mktime();
to:
$strCommandString = "[".mktime()."] RESTART_PROGRAM\n";
/usr/local/nagios/var/rw/nagios.cmd
But the old NagiosQL command does not work with Nagios 4.0.0. So edit verify.php and modify line 345 from:
$strCommandString = "[".mktime()."] RESTART_PROGRAM;".mktime();
to:
$strCommandString = "[".mktime()."] RESTART_PROGRAM\n";