We have a unique PHP-FPM set up, so I have written a script that gathers all the metrics we need, and want to pass that information back to Zabbix, and create items using discovery so the end result looks something like:
PHP-FPM Version 7.x.yy (application)
PHP-FPM Version 7.x.yy CPU
PHP-FPM Version 7.x.yy MEM
PHP-FPM Version 7.x.yy POOLS
PHP-FPM Version 7.x.yy THREADS
PHP-FPM Version 7.z.bb (application)
PHP-FPM Version 7.z.bb CPU
PHP-FPM Version 7.z.bb MEM
PHP-FPM Version 7.z.bb POOLS
PHP-FPM Version 7.z.bb THREADS
What I am missing is maybe a misunderstanding: Is it actually possible to send all the data back as JSON (or literally anything) and have it get parsed from that one run of the script? (what I am trying to do now). I run into the issue of not being able to make keys for item prototypes.
Or will I need to call it once to get back the versions as [{#PHPFPMVERSION}:7.x.yy},[{#PHPFPMVERSION}:7.z.bb}], then call the script in unique ways to make unique keys to get each individual stat? (call this the second way)
My implementation is using adding UserParameters:
UserParameter=phpstuff,/usr/local/bin/php /php-status/getphpstuff.php --full
to:
/etc/zabbix/zabbix_agent2.d/userparameter_php_fpm.conf
My understanding is I could just do something like the following to get the data for the item prototypes to have unique keys:
UserParameter=phpstuff[*],/usr/local/bin/php /php-status/getphpstuff.php --version $1 --cpu
UserParameter=phpstuff[*],/usr/local/bin/php /php-status/getphpstuff.php --version $1 --mem
I am caching the raw data already, so I can cache the output and write those methods, but I was kind of hoping I could avoid writing all that glue that if possible. If because of unique keys, is the second (or something else) the only way to do this?
PHP-FPM Version 7.x.yy (application)
PHP-FPM Version 7.x.yy CPU
PHP-FPM Version 7.x.yy MEM
PHP-FPM Version 7.x.yy POOLS
PHP-FPM Version 7.x.yy THREADS
PHP-FPM Version 7.z.bb (application)
PHP-FPM Version 7.z.bb CPU
PHP-FPM Version 7.z.bb MEM
PHP-FPM Version 7.z.bb POOLS
PHP-FPM Version 7.z.bb THREADS
What I am missing is maybe a misunderstanding: Is it actually possible to send all the data back as JSON (or literally anything) and have it get parsed from that one run of the script? (what I am trying to do now). I run into the issue of not being able to make keys for item prototypes.
Or will I need to call it once to get back the versions as [{#PHPFPMVERSION}:7.x.yy},[{#PHPFPMVERSION}:7.z.bb}], then call the script in unique ways to make unique keys to get each individual stat? (call this the second way)
My implementation is using adding UserParameters:
UserParameter=phpstuff,/usr/local/bin/php /php-status/getphpstuff.php --full
to:
/etc/zabbix/zabbix_agent2.d/userparameter_php_fpm.conf
My understanding is I could just do something like the following to get the data for the item prototypes to have unique keys:
UserParameter=phpstuff[*],/usr/local/bin/php /php-status/getphpstuff.php --version $1 --cpu
UserParameter=phpstuff[*],/usr/local/bin/php /php-status/getphpstuff.php --version $1 --mem
I am caching the raw data already, so I can cache the output and write those methods, but I was kind of hoping I could avoid writing all that glue that if possible. If because of unique keys, is the second (or something else) the only way to do this?