Ad Widget

Collapse

Can't make UserParameter send any data!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maciekish
    Junior Member
    • Sep 2009
    • 5

    #1

    Can't make UserParameter send any data!

    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):

    Code:
    UserParameter=system.processcpu[*],/etc/zabbix/userscript/processcpu.sh $1
    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:

    Code:
    sudo service zabbix-agent restart
    And got OK back.

    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
    Here is the script for reference:

    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"
    Attempting to graph the item yields "no data".
    Last edited by maciekish; 22-01-2012, 14:26.
Working...