hello all:
I am have a huge problem getting user macros to work. System macros seem to be fine. I have a template for MongoDB that I am trying to update to work with zabbix 2.2.1 originally written for zabbix 1.8x
First Problem:
One of the items of this template is to run an external script on the zabbix server which populates several zabbix trapper items. Here is the script usage:
The External check item definition looks like this:
mikoomi-mongodb-plugin.sh["-h","{HOST.IP}","-p","{MONGODB_PORT}","-z","{HOST.HOST}"]
this should expand to the command:
I actually get:
So the user macro MONGODB_PORT is not getting evaluated. I applied the template to the host in question and defined the macro {$MONGODB_PORT} = 27100 but it is not getting substituted.
Second problem:
I hard code the port parameter in the template and now it looks like the script call is formatted properly, HOWEVER I am not getting the trapper items, so it seems the script is not actually being executed. If I run the script as the zabbix user from the command line the trapper items are updated as expected. I have the zabbix_server in debug mode and I see nothing that shows me why this would be the case. As mentioned before this template was originally written for zabbix 1.8, once I get it working for 2.2x I will happily post this for others to enjoy.
The relevant log entries:
I am have a huge problem getting user macros to work. System macros seem to be fine. I have a template for MongoDB that I am trying to update to work with zabbix 2.2.1 originally written for zabbix 1.8x
First Problem:
One of the items of this template is to run an external script on the zabbix server which populates several zabbix trapper items. Here is the script usage:
Code:
Usage : mikoomi-mongodb-plugin.php [-D] [-h <mongoDB Server Host>] [-p <mongoDB Port>] [-u <username>] [-x <password>] -z <Zabbix_Name>
mikoomi-mongodb-plugin.sh["-h","{HOST.IP}","-p","{MONGODB_PORT}","-z","{HOST.HOST}"]
this should expand to the command:
Code:
/usr/lib/zabbix/externalscripts/mikoomi-mongodb-plugin.sh "-h" "10.11.101.22" "-p" "27100" "-z" "sirendb2"'
Code:
/usr/lib/zabbix/externalscripts/mikoomi-mongodb-plugin.sh "-h" "10.11.101.22" "-p" "{MONGODB_PORT}" "-z" "sirendb2"'
Second problem:
I hard code the port parameter in the template and now it looks like the script call is formatted properly, HOWEVER I am not getting the trapper items, so it seems the script is not actually being executed. If I run the script as the zabbix user from the command line the trapper items are updated as expected. I have the zabbix_server in debug mode and I see nothing that shows me why this would be the case. As mentioned before this template was originally written for zabbix 1.8, once I get it working for 2.2x I will happily post this for others to enjoy.
The relevant log entries:
Code:
6734:20140524:190858.850 In substitute_key_macros() data:'mikoomi-mongodb-plugin.sh["-h","{HOST.IP}","-p","27100","-z","{HOST.HOST}"]'
6734:20140524:190858.850 End of substitute_key_macros():SUCCEED data:'mikoomi-mongodb-plugin.sh["-h","10.11.101.21","-p","27100","-z","sirendb1"]'
6734:20140524:190858.850 In get_value() key:'mikoomi-mongodb-plugin.sh["-h","{HOST.IP}","-p","27100","-z","{HOST.HOST}"]'
6734:20140524:190858.851 In get_value_external() key:'mikoomi-mongodb-plugin.sh["-h","{HOST.IP}","-p","27100","-z","{HOST.HOST}"]'
6734:20140524:190858.851 In zbx_popen() command:'/usr/lib/zabbix/externalscripts/mikoomi-mongodb-plugin.sh "-h" "10.11.101.21" "-p" "27100" "-z" "sirendb1"'
/mikoomi-mongodb-plugin.php/usr/lib/zabbix/externalscripts
Comment