Hi
I'm trying to create a custom LLD to discover installed PHP versions, handlers in a cPanel server
I created the following User parameter:
test.pl is very simple:
The script output is like:
My discovery rule is like:
Name: php.version
Type: zabbix Agent (active)
Key: php.discovery
The item prototype is like:
Name: {$PHPVERSION}: Handler
Type: Zabbix Trapper
Key: php.handler[{#PHPVERSION}]
Type of information: Character
There is also another script using zabbix sender to send the data pairs:
zsend php.handler[alt-php74] cgi
But i'm getting:
php.handler[alt-php74] cgi
Response from "XXXX:10051": "processed: 0; failed: 1; total: 1; seconds spent: 0.000062"
zabbix server logs shows:
752039:20210201:112735.380 trapper got '{"request":"sender data","data":[{"host":"xxxxxx","key":"php.handler[alt-php74]","value":"cgi"}]}'
752039:20210201:112735.380 cannot retrieve key "php.handler[alt-php74]" on host "xxxxxx" from configuration cache
752416:20210201:113203.107 trapper got '{"request":"agent data","data":[{"id":176,"itemid":35282,"value":"[\n\t{\n\t\t"{#PHPVERSION}":"alt-php44",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php51",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php52",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php53",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php54",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php55",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php56",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php70",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php71",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php72",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php73",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php74",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php51",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php52",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php53",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php54",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php55",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php56",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php70",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php71",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php72",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php73",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php74",\n\t}\n]","clock":1612197122,"ns":456921}],"session":"62e361f4071f0b5ddb34443ffb4a4623"," hos t":"xxxxxxxx","version":"5.2"}'
So i'm guessing the item prototype is wrong or something else
Any idea or pointers in the right direction will be very much appreciated
I'm trying to create a custom LLD to discover installed PHP versions, handlers in a cPanel server
I created the following User parameter:
Code:
UserParameter=php.discovery,/etc/zabbix/scripts/test.pl
Code:
#!/usr/bin/perl
$first = 1;
print "[\n";
for (`whmapi1 php_get_installed_versions|grep php|tr -d " "|sed 's/-//'|grep -v command:`)
{
($php) = /(\S+)/;
print "\t,\n" if not $first;
$first = 0;
print "\t{\n";
print "\t\t\"{#PHPVERSION}\":\"$php\",\n";
print "\t}\n";
}
print "]\n";
Code:
[
{
"{#PHPVERSION}":"alt-php70",
}
,
{
"{#PHPVERSION}":"alt-php71",
}
,
{
"{#PHPVERSION}":"alt-php72",
}
,
{
"{#PHPVERSION}":"alt-php73",
}
,
{
"{#PHPVERSION}":"alt-php74",
}
]
Name: php.version
Type: zabbix Agent (active)
Key: php.discovery
The item prototype is like:
Name: {$PHPVERSION}: Handler
Type: Zabbix Trapper
Key: php.handler[{#PHPVERSION}]
Type of information: Character
There is also another script using zabbix sender to send the data pairs:
zsend php.handler[alt-php74] cgi
But i'm getting:
php.handler[alt-php74] cgi
Response from "XXXX:10051": "processed: 0; failed: 1; total: 1; seconds spent: 0.000062"
zabbix server logs shows:
752039:20210201:112735.380 trapper got '{"request":"sender data","data":[{"host":"xxxxxx","key":"php.handler[alt-php74]","value":"cgi"}]}'
752039:20210201:112735.380 cannot retrieve key "php.handler[alt-php74]" on host "xxxxxx" from configuration cache
752416:20210201:113203.107 trapper got '{"request":"agent data","data":[{"id":176,"itemid":35282,"value":"[\n\t{\n\t\t"{#PHPVERSION}":"alt-php44",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php51",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php52",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php53",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php54",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php55",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php56",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php70",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php71",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php72",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php73",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"a lt-php74",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php51",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php52",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php53",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php54",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php55",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php56",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php70",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php71",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php72",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php73",\n\t}\n\t,\n\t{\n\t\t"{#PHPVERSION}":"e a-php74",\n\t}\n]","clock":1612197122,"ns":456921}],"session":"62e361f4071f0b5ddb34443ffb4a4623"," hos t":"xxxxxxxx","version":"5.2"}'
So i'm guessing the item prototype is wrong or something else
Any idea or pointers in the right direction will be very much appreciated
Comment