Ad Widget

Collapse

Userparameter only works partly

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • porkcharsui
    Junior Member
    • May 2012
    • 15

    #1

    Userparameter only works partly

    We use a small program called "rwtest", to test write and read speed on a nfs mount. It's output is like the following:
    Code:
    open: 140082 microseconds
    read: 25692 microseconds
    close: 470 microseconds
    open: 3890 microseconds
    write: 742 microseconds
    close: 29436 microseconds
    I've written the following userparameter for it:
    Code:
    UserParameter=readtest[*],rwtest /home/homedir-request/rwtest/rwtest.$(hostname -f) 2> /dev/null | grep -m1 "$1" | egrep -o "[[:digit:]]{0,9}"
    When I use "zabbix_get" from the proxy server I get the following weird behaviour:
    Code:
    root@zabbix_proxy:~# zabbix_get -s myhost -k "readtest[open]"
    2240
    root@zabbix_proxy:~# zabbix_get -s myhost -k "readtest[read]"
    
    root@zabbix_proxy:~# zabbix_get -s myhost -k "readtest[close]"
    And in the agent log with debug level 4 I see this:
    Code:
    $1=open:
    11658:20151126:165115.014 Requested [readtest[open]]
    11658:20151126:165115.014 In zbx_popen() command:'rwtest /home/homedir-request/rwtest/rwtest.$(hostname -f) 2> /dev/null | grep -m1 "open" | egrep -o "[[:digit:]]{0,9}"'
    11658:20151126:165115.014 End of zbx_popen():7
    11669:20151126:165115.014 zbx_popen(): executing script
    11658:20151126:165115.022 In zbx_waitpid()
    11658:20151126:165115.023 zbx_waitpid() exited, status:0
    11658:20151126:165115.023 End of zbx_waitpid():11669
    11658:20151126:165115.023 Run remote command [rwtest /home/homedir-request/rwtest/rwtest.$(hostname -f) 2> /dev/null | grep -m1 "open" | egrep -o "[[:digit:]]{0,9}"] Result [4] [2240]...
    11658:20151126:165115.023 Sending back [2240]
    
    $1=close
    11660:20151126:165118.789 Requested [readtest[close]]
    11660:20151126:165118.789 In zbx_popen() command:'rwtest /home/homedir-request/rwtest/rwtest.$(hostname -f) 2> /dev/null | grep -m1 "close" | egrep -o "[[:digit:]]{0,9}"'
    11660:20151126:165118.789 End of zbx_popen():7
    11674:20151126:165118.790 zbx_popen(): executing script
    11660:20151126:165118.798 In zbx_waitpid()
    11660:20151126:165118.798 zbx_waitpid() exited, status:1
    11660:20151126:165118.798 End of zbx_waitpid():11674
    11660:20151126:165118.798 Run remote command [rwtest /home/homedir-request/rwtest/rwtest.$(hostname -f) 2> /dev/null | grep -m1 "close" | egrep -o "[[:digit:]]{0,9}"] Result [0] []...
    11660:20151126:165118.798 Sending back []
    On the command line all the commands work perfectly, but when using zabbix_get they don't!?

    I've tried "echoing" the result to eliminate the influence of the "rwtest" program, but I get the same result. I even tried reversing the output of the "rwtest" program before "grepping" to see if it was only displaying the top line, but again... the same result. It will only display the results from "open" and not the rest.

    I've kinda run out of things to try, so I was hoping someone here could help me with this very weird behaviour.
Working...