check_nginx_status
check_nginx_status copied to clipboard
Illegal division by zero
Hi
Can you help me please,Thank you very much. and,sorry,I'm not be good at speak in english.
I'm used check_nginx_status.pl for nagios,when the plugin run,it show:
[root@jn-dellpcserver06 GDGraph-1.48]# /usr/local/nagios/libexec/check_nginx_status.pl -H 192.168.120.157 -u /status -t 8 -w 10000,100,200 -c 20000,200,300
Illegal division by zero at /usr/local/nagios/libexec/check_nginx_status.pl line 372.
Line372: my $ReqPerConn = $NbRequests/$AcceptedConn;
[root@jn-dellpcserver06 GDGraph-1.48]# /usr/local/nagios/libexec/check_nginx_status.pl -H 192.168.120.157 -u /status Illegal division by zero at /usr/local/nagios/libexec/check_nginx_status.pl line 372.
Line372: my $ReqPerConn = $NbRequests/$AcceptedConn;
My PHP [root@jn-dellpcserver06 ~]# rpm -qa |grep php php-fpm-5.5.3-1.el5.remi php-gd-5.5.3-1.el5.remi php-common-5.5.3-1.el5.remi php-pgsql-5.5.3-1.el5.remi php-process-5.5.3-1.el5.remi php-mysqlnd-5.5.3-1.el5.remi php-pecl-zip-1.12.1-2.el5.remi.1 php-mbstring-5.5.3-1.el5.remi php-pecl-apcu-4.0.1-2.el5.remi.1 php-xml-5.5.3-1.el5.remi php-pdo-5.5.3-1.el5.remi php-mcrypt-5.5.3-1.el5.remi php-pecl-memcached-2.1.0-6.el5.remi.5 php-pear-1.9.4-20.el5.remi php-pecl-mongo-1.4.3-1.el5.remi.1 php-pecl-jsonc-1.3.1-2.el5.remi.2 php-pecl-sqlite-2.0.0-0.3.svn313074.el5.remi.5 php-cli-5.5.3-1.el5.remi php-pecl-memcache-3.0.8-1.el5.remi.1
php-pecl-igbinary-1.1.2-0.5.git3b8ab7e.el5.remi.1
My php-fpm status by http layout [root@Nagios-2012R1-111 services]# curl http://192.168.120.157/status pool: www process manager: dynamic start time: 05/Sep/2013:10:47:05 +0800 start since: 3326 accepted conn: 405 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 5 active processes: 1 total processes: 6 max active processes: 3 max children reached: 0 slow requests: 0
a test if ($acceptedConn > 0) before this line [root@jn-dellpcserver06 ~]# ./check_nginx_status.pl -H 192.168.120.157 -u /status "my" variable $ReqPerConn masks earlier declaration in same scope at ./check_nginx_status.pl line 389. syntax error at ./check_nginx_status.pl line 373, near ") my " Global symbol "$ReqPerConn" requires explicit package name at ./check_nginx_status.pl line 373. Global symbol "$ReqPerConn" requires explicit package name at ./check_nginx_status.pl line 377.
Execution of ./check_nginx_status.pl aborted due to compilation errors.
Note that your /status url reports php_fpm status and not nginx status. See my other nagios script https://github.com/regilero/check_phpfpm_status for php_fpm report analysis. This nginx check should instead request the nginx report (usually on nginx_status when activated in nginx). php_fpm and nginx are two different daemons, each one having a status report. Requesting nginx status via the php_fpm status url will never work.
Anyway we should not crash on a divide by zero error so I have somethig to fix on the script.
Could you please test the latest commit fix : https://github.com/regilero/check_nginx_status/commit/75d8e5c72525a613c520bc3cf6c3cb3e87ecdac0
And still tests it on the bad status url to see if the divide by zero crash is removed?