Hi,
I'm looking at some extra scripts about how to get information from iostat, nginx, etc., and I'm wondering about the efficiency of running the same script multiple times within one interval.
Like this nginx script:
And it's corresponding UserParameters setting will be:
UserParameter=nginx[*], bash /usr/share/zabbix/scripts/zabbix_nginx_check.sh $1 $2
Does this mean if the server wanna get all seven items from this script, it need to be run seven times?
This script includes a wget, so I think it's fairly cheap. So is the iostat script, it only reads from the plain text file, which is generated periodically by cron job. When running multiple times, it seems all fine.
But how about a heavy operation? To get multiple items it'll be too expensive.
For instance, I want to get JVM info through a port number. First I grep the output of netstat command and get the pid, then run jstat and get ec, eu, etc. But use UserParameters, this procedure will be performed multiple times. Also it's not very practical to list all jvm's info into a plain text file, cause the port comes and goes.
In Cacti there's no such problem, 'cause user defined items could be fetched through a single line, like "ec:123 eu:456".
How to deal with this scenario in Zabbix?
Thanks.
I'm looking at some extra scripts about how to get information from iostat, nginx, etc., and I'm wondering about the efficiency of running the same script multiple times within one interval.
Like this nginx script:
And it's corresponding UserParameters setting will be:
UserParameter=nginx[*], bash /usr/share/zabbix/scripts/zabbix_nginx_check.sh $1 $2
Does this mean if the server wanna get all seven items from this script, it need to be run seven times?
This script includes a wget, so I think it's fairly cheap. So is the iostat script, it only reads from the plain text file, which is generated periodically by cron job. When running multiple times, it seems all fine.
But how about a heavy operation? To get multiple items it'll be too expensive.
For instance, I want to get JVM info through a port number. First I grep the output of netstat command and get the pid, then run jstat and get ec, eu, etc. But use UserParameters, this procedure will be performed multiple times. Also it's not very practical to list all jvm's info into a plain text file, cause the port comes and goes.
In Cacti there's no such problem, 'cause user defined items could be fetched through a single line, like "ec:123 eu:456".
How to deal with this scenario in Zabbix?
Thanks.
Comment