Ad Widget

Collapse

comparitive shell script and userparameter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cirrhus9.com
    Member
    • Feb 2012
    • 58

    #1

    comparitive shell script and userparameter

    My fellow zabbix enthusiasts:

    I have an aggregate comparison I need help with.
    Our client has lumberjack running and has asked us to compare the number of lumberjack processes against the number of conf files in /etc/lumberjack/conf.d

    In bash, I came up with this:
    Code:
    if [[ $(ls -1 /etc/lumberjack/conf.d | wc -l) =  $(pidof lumberjack | wc -w) ]]; then     echo True ; else echo False ; fi
    and stuck it in a script.sh.

    Nothing I do, can get this item out of ZBX_NOTSUPPORTED

    I enabled UnsafeUserParameters=1 per https://www.zabbix.com/documentation...userparameters and set this on the hosts' zabbix_agentd.conf:
    Code:
    UserParameter=number.lumberjack.processes,/root/lumberjack_test.sh
    looking at a Windows aggregate trigger, I believe there is a "better" way...

    Code:
    {hostname:vm.memory.size[free].last(600)}/{hostname:vm.memory.size[total].last(600)}<0.02 & {hostname:perf_counter[\Memory\Page Reads/sec].avg(300)}/{hostname:perf_counter[\Memory\Page Faults/sec].avg(300)}>0.3
    How should this be written?
    Thank you for your time.

    Edit: Mon Nov 18, 2013 - 7:06:33 PM EST

    Went another route:
    Code:
    UserParameter=number.lumberjack.procs,pidof lumberjack | wc -w
    UserParameter=number.lumberjack.confs,ls -1 /etc/lumberjack/conf.d | wc -l
    But I'm now unclear on how to write the trigger for procs(x)=confs(x), but something like this?

    Code:
    {Web1:number.lumberjack.procs.last(#)} = {Web1:number.lumberjack.confs.last(#)}
    Thanks!

    Seems to "be"
    Code:
    {Web1:number.lumberjack.procs.last(0)}<{Web1:number.lumberjack.confs.last(0)}
    Last edited by cirrhus9.com; 19-11-2013, 02:17.
Working...