Hi,
I'm trying to log CPU usage of certain processes using a script i made.
The UserParamter is defined as follows (both in zabbix_agent and zabbix_agentd.conf since i dont know which one is in use):
Running the script like this /etc/zabbix/userscript/processcpu.sh smbd displays the correct % when transferring a large file, running the script as a regular user.
However after adding an item to my linux template, it doesnt show up in "latest data" or when selecting keys in the zabbix ui (should it appear there?). After editing the config i restarted the agent using:
And got OK back.
I configured the zabbix item like this
Here is the script for reference:
Attempting to graph the item yields "no data".
I'm trying to log CPU usage of certain processes using a script i made.
The UserParamter is defined as follows (both in zabbix_agent and zabbix_agentd.conf since i dont know which one is in use):
Code:
UserParameter=system.processcpu[*],/etc/zabbix/userscript/processcpu.sh $1
However after adding an item to my linux template, it doesnt show up in "latest data" or when selecting keys in the zabbix ui (should it appear there?). After editing the config i restarted the agent using:
Code:
sudo service zabbix-agent restart
I configured the zabbix item like this
Code:
Host Template_Linux Description CPU Usage Apache2 Type Zabbix agent Key system.processcpu[apache2] Type of information Numeric (unsigned) Data type Decimal Units % Use custom multiplier No Update interval (in sec) 20
Code:
samples=3
values=$(top -b -n $samples | grep smbd | cut -c 43-45)
valuesarr=(`echo $values | tr " " "\n"`)
total=0
for x in "${valuesarr[@]}"
do
total=`echo $total + $x | bc`
done
total=`echo $total / $samples | bc`
echo "$total"