Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Illegal division by zero #5

Open
wujingwang opened this issue Sep 6, 2013 · 2 comments
Open

Illegal division by zero #5

wujingwang opened this issue Sep 6, 2013 · 2 comments

Comments

@wujingwang
Copy link

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.

@regilero
Copy link
Owner

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.

@regilero
Copy link
Owner

Could you please test the latest commit fix : 75d8e5c

And still tests it on the bad status url to see if the divide by zero crash is removed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants