PHP-FPM monitoring


#1

Hello,

Can someone to help me configure monitoring PHP-FPM, please?
I am novice with Sensu and I do not know how to write properly .json to php-fpm.

Regards,
Rostyslav


#2

Hello Rostyslav,

Can someone to help me configure monitoring PHP-FPM, please?

What parts of PHP-FPM are you trying to monitor?

I am novice with Sensu and I do not know how to write properly .json to
php-fpm.

I would start with the check-proccess[1] check and monitor for the pid file.

Please tell us what you can't do exactly, so we can help you the best we can.

[1] https://github.com/sensu-plugins/sensu-plugins-process-checks

Regards,

···

--
Alfredo Palhares
GPG/PGP Key Fingerprint
68FC B06A 6C22 8B9B F110
38D6 E8F7 4D1F 0763 CAAD


#3

If you want to monitor anything with Sensu, the easiest thing you can do is find any command that works on the command-line, and configure a Sensu check with that command. Something like “curl http:127.0.0.1/somepath” is probably the simplest thing that could work. Looks like there is a community plugin that you could probably hook up (https://github.com/sensu-plugins/sensu-plugins-php-fpm).

Looking at the “Example Check Definition” here might get you started with creating a check definition in JSON.

Good luck!

···

On Friday, October 2, 2015 at 4:05:21 AM UTC-7, Rostyslav Malenko wrote:

Hello,

Can someone to help me configure monitoring PHP-FPM, please?
I am novice with Sensu and I do not know how to write properly .json to php-fpm.

Regards,
Rostyslav


#4

Thank you for answers.

I have created php-fpm.json but I am not sure that it is properly json file, because I have seen in Ushiva nothing.
I would like to check is php-fpm available, pass to Graphite statistic. An, if it possible, monitor and collect statistics by pool. An get alert for 50x error, if they appeared.

{
“checks”: {
“phpfpm_check”: {
“command”: “/etc/sensu/plugins/check_php-fpm.rb”,
“interval”: 30,
“subscribers”: [“webserves”],
“handlers”: [“graphite”]
},
“phpfpm_metrics”: {
“type”: “metric”,
“command”: “/etc/sensu/plugins/php-fpm-metrics.rb”,
“interval”: 10,
“subscribers”: [“webserves”],
“handlers”: [“graphite”]
}

``

}
}

Thank you advance for support.

···

On Friday, October 2, 2015 at 2:05:21 PM UTC+3, Rostyslav Malenko wrote:

Hello,

Can someone to help me configure monitoring PHP-FPM, please?
I am novice with Sensu and I do not know how to write properly .json to php-fpm.

Regards,
Rostyslav


#5

That looks like a good start. There is a bit to get your head around when starting.

One thing that jumps out is the check-php-fpm.rb plugin being sent to the “graphite” handler. Generally, you’d want to handle metrics differently than checks, so you’d want some handler that sent the alert to PagerDuty, or your cell phone, or whatever.

Can you create a gist (gist.github.com), showing

  • The output of “sudo -u sensu /etc/sensu/plugins/php-fpm-metrics.rb” from one of your web servers
  • The output of “sudo -u sensu /etc/sensu/plugins//check_php-fpm.rb” from one of your web servers
  • The JSON definitions of your handlers (i.e. “graphite”).

Also, a screenshot of your Uchiwa “checks” and “clients” pages, with sensitive information blurred?

Good luck!

···

On Mon, Oct 12, 2015 at 12:38 PM, Rostyslav Malenko rmalenko@gmail.com wrote:

Thank you for answers.

I have created php-fpm.json but I am not sure that it is properly json file, because I have seen in Ushiva nothing.
I would like to check is php-fpm available, pass to Graphite statistic. An, if it possible, monitor and collect statistics by pool. An get alert for 50x error, if they appeared.

{
“checks”: {
“phpfpm_check”: {
“command”: “/etc/sensu/plugins/check_php-fpm.rb”,
“interval”: 30,
“subscribers”: [“webserves”],
“handlers”: [“graphite”]
},
“phpfpm_metrics”: {
“type”: “metric”,
“command”: “/etc/sensu/plugins/php-fpm-metrics.rb”,
“interval”: 10,
“subscribers”: [“webserves”],
“handlers”: [“graphite”]
}

}
}

Thank you advance for support.

On Friday, October 2, 2015 at 2:05:21 PM UTC+3, Rostyslav Malenko wrote:

Hello,

Can someone to help me configure monitoring PHP-FPM, please?
I am novice with Sensu and I do not know how to write properly .json to php-fpm.

Regards,
Rostyslav

:peace_symbol:
Nick Stielau
206-245-7991


#6

Nick, thank you for answer.

FPM status and ping is enabled and works

Output for sudo -u sensu /etc/sensu/plugins/check_php-fpm.rb --u http://localhost/fpm-ping?pool=www

https://gist.github.com/rmalenko/9c9556255736b83e668e

Output for sudo -u sensu /etc/sensu/plugins/php-fpm-metrics.rb --url http://localhost/fpm-status
https://gist.github.com/rmalenko/6f8b6799ba886cc091e2

I hope I will not have an question about Graphite, after resolve this issue with your help :slight_smile:

Regards,
Rostyslav

···

#7

Cool, so you’re want to debug why those commands are not outputting correctly. Looks like it is a load issue with https://rubygems.org/gems/crack/versions/0.4.2, so you’ll want to make sure that is installed with gem and being loaded correctly.

···

On Thu, Oct 15, 2015 at 4:53 AM, Rostyslav Malenko rmalenko@gmail.com wrote:

Nick, thank you for answer.

FPM status and ping is enabled and works

Output for sudo -u sensu /etc/sensu/plugins/check_php-fpm.rb --u http://localhost/fpm-ping?pool=www

https://gist.github.com/rmalenko/9c9556255736b83e668e

Output for sudo -u sensu /etc/sensu/plugins/php-fpm-metrics.rb --url http://localhost/fpm-status
https://gist.github.com/rmalenko/6f8b6799ba886cc091e2

I hope I will not have an question about Graphite, after resolve this issue with your help :slight_smile:

Regards,
Rostyslav

:peace_symbol:
Nick Stielau
206-245-7991


#8

Hello Nick

When I ran curl http://localhost/fpm-ping
I got answer pong :slight_smile:

I.e. Localhost get right responce
May I need to install a gem?

sudo -u sensu /etc/sensu/sensu-community-plugins/plugins/php-fpm/php-fpm-metrics.rb --url http://localhost/fpm-ping

Check failed to run: undefined method []' for nil:NilClass, ["/etc/sensu/sensu-community-plugins/plugins/php-fpm/php-fpm-metrics.rb:72:inblock in run’", “/etc/sensu/sensu-community-plugins/plugins/php-fpm/php-fpm-metrics.rb:71:in each'", "/etc/sensu/sensu-community-plugins/plugins/php-fpm/php-fpm-metrics.rb:71:inrun’”, “/var/lib/gems/2.1.0/gems/sensu-plugin-1.2.0/lib/sensu-plugin/cli.rb:56:in `block in class:CLI’”]

``

···

On Thursday, October 15, 2015 at 5:28:16 PM UTC+3, Nick Stielau wrote:

Cool, so you’re want to debug why those commands are not outputting correctly. Looks like it is a load issue with https://rubygems.org/gems/crack/versions/0.4.2, so you’ll want to make sure that is installed with gem and being loaded correctly.

On Thu, Oct 15, 2015 at 4:53 AM, Rostyslav Malenko rmal...@gmail.com wrote:

Nick, thank you for answer.

FPM status and ping is enabled and works

Output for sudo -u sensu /etc/sensu/plugins/check_php-fpm.rb --u http://localhost/fpm-ping?pool=www

https://gist.github.com/rmalenko/9c9556255736b83e668e

Output for sudo -u sensu /etc/sensu/plugins/php-fpm-metrics.rb --url http://localhost/fpm-status
https://gist.github.com/rmalenko/6f8b6799ba886cc091e2

I hope I will not have an question about Graphite, after resolve this issue with your help :slight_smile:

Regards,
Rostyslav

:peace_symbol:
Nick Stielau
206-245-7991