tjstein / php5-fpm-munin-plugins

A set of Munin plugins for PHP5-FPM
http://tjstein.com
MIT License
109 stars 45 forks source link

php_average.value awk: cmd. line:1: fatal: division by zero attempted #7

Closed sesser closed 13 years ago

sesser commented 13 years ago

Getting this error with phpfpm_average script

hermzz commented 13 years ago

Make sure you've set the right env.phpbin value in the munin config file so that it matches the name of your php binary.

sesser commented 13 years ago

Ah, I missed that in the readme. defaults to php5-fpm. Works now. Thanks!

siment commented 12 years ago

I know this is a closed issue, but I am getting the same error (or very similar):

Error output from phpfpm_average:
awk: fatal: division by zero attempted
Service 'phpfpm_average' exited with status 2/0.

I have set env.phpbin value to

/usr/sbin/php5-fpm

(same as which php5-fpm)

Any comments on that? And thank you for writing this plugin.

EDIT: type-o

hermzz commented 12 years ago

Sorry for the delayed response, which php5-fpm should be correct, but can you do a ps axu to make sure that's the binary getting executed? After all, that's pretty much what the script does.

siment commented 12 years ago

I appreciate the response.

I guess my system is outputs differently. When doing _ps aux | grep php-fpm_

I get the following:

www-data  4033  3.1  3.3 955772 134304 ?       S    19:51   3:13 php-fpm: pool www                                         
www-data  4035  3.1  3.1 958092 128536 ?       R    19:52   3:10 php-fpm: pool www                                         
www-data  4050  3.1  3.5 957792 143532 ?       S    19:54   3:11 php-fpm: pool www                                         
www-data  4446  3.2  3.5 958052 144716 ?       S    19:55   3:11 php-fpm: pool www                                         
www-data 13222  4.9  2.8 957584 117024 ?       S    21:04   1:30 php-fpm: pool www                                         
www-data 16893  0.0  0.0 933568  3036 ?        S    21:34   0:00 php-fpm: pool www 
...
...

_ps aux | grep /usr/sbin/php5-fpm_ returns

root     17059  0.0  0.0  10844   892 pts/0    S+   21:35   0:00 grep --color=auto /usr/sbin/php5-fpm

It seems obvious to me that an average memory value would consist of an average of all the previous php-fpm processes. I might be wrong and completely misunderstanding the purpose of this plugin.

The fact that I always have to tweak Munin-plugins similar to this make me think that Ubuntu 12.04 is outputting different values when doing _ps aux_ than most systems web hosters use.

FYI mostly. Comments appreciated.

unifex22 commented 11 years ago

I dont get it. I have the same Error like sesser.

What must i write in which file? In my file /etc/munin/munin.conf is no section with a default php part.

hermzz commented 11 years ago

You configure plugins in the plugins in the /etc/munin/plugin-conf.d/munin-node file. In this case try something like

[php5-fpm]
env.phpbin php5-fpm