Hello
Our vendor want to know how much zabbix-agent is creating CPU load
So I did bash script what is cheduled to crontab to run every minute
added to zabbix_agentd.conf
UserParameter=zabbix.cpu-usage,cat /tmp/zabbix-cpu-usage.txt
So is there better way?
and
Is my count right?
// Lake
Our vendor want to know how much zabbix-agent is creating CPU load
So I did bash script what is cheduled to crontab to run every minute
Code:
#!/bin/bash
sample=18
cpu=$(lscpu | grep ^"CPU(s):" | awk '{ print $2}')
cpu_usage=$(/usr/bin/top -b -n $sample -u zabbix | awk -v CPU="$cpu" -v SAMPLE="$sample" 'NR>7 { sum += $9; } END { print (sum/SAMPLE)/CPU; }')
echo $cpu_usage > /tmp/zabbix-cpu-usage.txt
UserParameter=zabbix.cpu-usage,cat /tmp/zabbix-cpu-usage.txt
So is there better way?
and
Is my count right?
// Lake