PHP-FPM Status template

Templates, scripts for templates, scripts and requests for templates.

Moderators: Developers, Moderators

Lucky SB
Posts: 1
Joined: Thu Jan 27, 2011 2:48 pm

PHP-FPM Status template

Post by Lucky SB »

get_php_fpm_status.pl copy to ../scripts directory
cacti_graph_template_php-fpm_pool_status.xml import to cacti

Script check url http://server:port/phpfpm-status

Thanks for .xml and idea for Alexander Moskalenko
http://forum.nginx.org/read.php?25,1679 ... msg-167900
Attachments
cacti-phpfpmstatus.zip
(3.58 KiB) Downloaded 1704 times
poison27
Posts: 1
Joined: Sat Jan 29, 2011 7:52 am

Re: PHP-FPM Status template

Post by poison27 »

I have rewritten your version to be compatible with newer versions of php (5.3.5) (new status message lines were added).

I have rewritten perl part to php.
some minor changes (graph colors and style)
graph_image.png
graph_image.png (38.17 KiB) Viewed 17739 times
Attachments
cacti-phpfpm.tar.gz
(3.53 KiB) Downloaded 911 times
nicholasrobinson
Posts: 1
Joined: Fri Mar 18, 2011 5:24 pm

Re: PHP-FPM Status template

Post by nicholasrobinson »

Thanks for the inspiration guys, unfortunately the template was incompatible with my stable apt-get cacti 0.8.7e installation , so I recreated and restyled the template.

A Template compatible with Cacti 0.8.7e and get_php_fpm_status.php is attached!
Attachments
PHP-FPM-Template.tar
(21 KiB) Downloaded 803 times
akubashin
Posts: 1
Joined: Sat Apr 16, 2011 3:58 pm

Re: PHP-FPM Status template

Post by akubashin »

My version of this template. It's based on original perl script from 1st post, and xml templates from last reply.
Template created in cacti 0.8.7f under CentOS 5.6.
Attachments
cacti-php.png
cacti-php.png (26.74 KiB) Viewed 17411 times
cacti-php-fpm-statistic.zip
(3.96 KiB) Downloaded 910 times
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Re: PHP-FPM Status template

Post by TECK »

Hi guys,

I'm trying to get one of these templates working and I get connection errors.
Any ideas how I could fix them?

Can't locate FCGI/Client.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at /usr/share/cacti/scripts/get_php_fpm_status.pl line 21.

OR

/usr/bin/perl /usr/share/cacti/scripts/get_php_fpm_status.pl -H 192.168.0.2 -s /phpfpm-status -p 9000
Can't locate object method "new" via package "LWP::UserAgent" at /usr/share/cacti/scripts/get_php_fpm_status.pl line 25.
TECK
Posts: 16
Joined: Sun May 27, 2007 2:13 am

Re: PHP-FPM Status template

Post by TECK »

I forgot to mention that I use Nginx as web server, on CentOS 5.6 x64.
noname
Cacti Guru User
Posts: 1566
Joined: Thu Aug 05, 2010 2:04 am
Location: Japan

Re: PHP-FPM Status template

Post by noname »

TECK wrote:Can't locate FCGI/Client.pm ...
Can't locate object method "new" via package "LWP::UserAgent" ...
Did you install these Perl modules?

How to check:
% perl -MFCGI::Client -e '' (single quote x2)
% perl -MLWP::UserAgent -e ''
It is installed if nothing printed.
phenx
Posts: 5
Joined: Wed Aug 24, 2011 5:35 am

Re: PHP-FPM Status template

Post by phenx »

Please note that upgrading to PHP 5.3.8 will break this template.

Output of php-fpm status changes from:

pool: www
process manager: dynamic
accepted conn: 9078552
listen queue len: 0
max listen queue len: 128
idle processes: 299
active processes: 1
total processes: 300
max children reached: 1

to:

pool: www
process manager: dynamic
start time: 24/Aug/2011:02:35:12 -0700
start since: 3481
accepted conn: 78464
listen queue: 0
max listen queue: 1
listen queue len: 128
idle processes: 109
active processes: 1
total processes: 110
max active processes: 15
max children reached: 0

Changes that you need to make to the get_php_fpm_status.pl script are as follows:

You simply need to update the line markers for the $content[] array:

I've attached the patched perl script.
Attachments
get_php_fpm_status.pl
(1.29 KiB) Downloaded 1164 times
tosage
Cacti User
Posts: 164
Joined: Wed Jul 28, 2010 5:05 am
Location: France

Re: PHP-FPM Status template

Post by tosage »

Sorry for the dummy question, so What is PHP-FPM ? :roll:
We can have information about this and the job do by this template ?

Thanks a lot :D
Cacti Version - 0.8.8a
Plugin Architecture - 3.1
Poller Type - spine
Server Info - Linux
Web Server - Apache/2.2.22 (Ubuntu)
PHP - 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli)
MySQL - 5.5.29-0ubuntu0.12.04.2
RRDTool - 1.4.7
iko
Posts: 1
Joined: Thu Sep 01, 2011 2:28 am

Re: PHP-FPM Status template

Post by iko »

Hello everyone,

inspired by this template I create other PHP-FPM statistics without need of web server. Why ?
1. My php and web servers are usually different machines and I want graphs to be associated with every machine, not a web server
2. I usually use several PHP-FPM ports on one machine and I want to monitor them all (it was difficult to describe different virtual host for every machine/port)
3. I just wanted to do it :)

So I modified one nagios script that monitor PHP-FPM and make it useful with cacti. Perl script requires FCGI::Client module:
http://search.cpan.org/~tokuhirom/FCGI- ... /Client.pm

Copy cacti_check_php-fpm.pl to cacti scripts directory and import .xml template. Allow cacti server to connect to PHP-FPM server in your php-fpm.conf . Create new graphs.

This is my first cacti template, so if I miss something, let me know.

p.s. it should work with php 5.3.8 (I've tested it with 5.3.6)
Attachments
cacti-php-fpm.tar.gz
Cacti PHP-FPM fastcgi statistics
(4.67 KiB) Downloaded 835 times
glen
Posts: 9
Joined: Sun Oct 05, 2008 10:46 am

Re: PHP-FPM Status template

Post by glen »

i've imported the HTTP based template to github and made some changes
https://github.com/glensc/cacti-template-php-fpm

it supports polling over HTTP and over FCGI.
User avatar
The ustas
Posts: 18
Joined: Wed Jun 27, 2007 6:22 am
Location: Russia Moscow
Contact:

Re: PHP-FPM Status template

Post by The ustas »

glen wrote:i've imported the HTTP based template to github and made some changes
https://github.com/glensc/cacti-template-php-fpm

it supports polling over HTTP and over FCGI.
hi i install this but not work

Code: Select all

GET http://127.0.0.1:80'/status'?'': Can't connect to 127.0.0.1:80':80 (Bad hostname) at /home/d0/www/vhosts/ion.widax.ru/docroot/cacti/scripts/get_php_fpm_status.pl line 71.
PHP-FPM Status work

Code: Select all

pool:                 www
process manager:      ondemand
start time:           13/Aug/2013:12:14:12 +0400
start since:          10526
accepted conn:        1248
listen queue:         0
max listen queue:     1
listen queue len:     128
idle processes:       0
active processes:     1
total processes:      1
max active processes: 6
max children reached: 0
slow requests:        0
where is error ?
dreads
Posts: 2
Joined: Tue Aug 13, 2013 10:05 pm

Re: PHP-FPM Status template

Post by dreads »

The ustas wrote: hi i install this but not work

Code: Select all

GET http://127.0.0.1:80'/status'?'': Can't connect to 127.0.0.1:80':80 (Bad hostname) at /home/d0/www/vhosts/ion.widax.ru/docroot/cacti/scripts/get_php_fpm_status.pl line 71.
The host name is wrong. I've not looked at the template so I can't say whether it is the template or your settings, but it is trying to connect to 127.0.0.1:80':80 instead of 127.0.0.1:80.
User avatar
The ustas
Posts: 18
Joined: Wed Jun 27, 2007 6:22 am
Location: Russia Moscow
Contact:

Re: PHP-FPM Status template

Post by The ustas »

dreads wrote:
The ustas wrote: hi i install this but not work

Code: Select all

GET http://127.0.0.1:80'/status'?'': Can't connect to 127.0.0.1:80':80 (Bad hostname) at /home/d0/www/vhosts/ion.widax.ru/docroot/cacti/scripts/get_php_fpm_status.pl line 71.
The host name is wrong. I've not looked at the template so I can't say whether it is the template or your settings, but it is trying to connect to 127.0.0.1:80':80 instead of 127.0.0.1:80.
i download this template at https://github.com/glensc/cacti-template-php-fpm
dreads
Posts: 2
Joined: Tue Aug 13, 2013 10:05 pm

Re: PHP-FPM Status template

Post by dreads »

The ustas wrote:
dreads wrote:
The ustas wrote: hi i install this but not work

Code: Select all

GET http://127.0.0.1:80'/status'?'': Can't connect to 127.0.0.1:80':80 (Bad hostname) at /home/d0/www/vhosts/ion.widax.ru/docroot/cacti/scripts/get_php_fpm_status.pl line 71.
The host name is wrong. I've not looked at the template so I can't say whether it is the template or your settings, but it is trying to connect to 127.0.0.1:80':80 instead of 127.0.0.1:80.
i download this template at https://github.com/glensc/cacti-template-php-fpm
The template worked fine for me, I would say that you have a typo in your data somewhere. At a Guess I would say you have '/status' in the "Path to status URI" field. Try changing it to /status (so get rid of the single quotes).
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests