Ad Widget

Collapse

Userparameter command status code not being picked up correctly.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andre@andaff.com
    Junior Member
    • Jan 2013
    • 2

    #1

    Userparameter command status code not being picked up correctly.

    Hoping someone can shed some light on this and maybe provide an easy solution to monitoring software raid configs.

    Some Details
    Zabbix server= 2.0.2
    Zabbix Client = same

    I am a long time user of zabbix since the pre 1.0 versions and in the past created scripts for many of my custom checks, recently I have started using puppet for server builds and have moved to using zabbix userparameters in the zabbix_agentd.conf for any custom checks because it was easy to build a zabbix module that auto created the zabbix_agentd.conf with a new server build and to use host exceptions in the erb template to create a host specific zabbix conf. (probably too much info but I am not looking for a workaround scripting solution for my problem).

    I am trying to monitor software raid arrays and the proper way to do this without using the mdadm --monitor feature is to use the following line.

    /sbin/mdadm --detail --brief --test /dev/md3 &>/dev/null;echo $?
    #the resulting command status code if 0 is an "OK Array", all other numbers reflect a different issue with the array.

    My problem is this command sends a 0 out at the command line but zabbix captures a 1. I would assume the command status code is reflecting something different.

    Here is my line in zabbix_agentd.conf
    UserParameter=it.raid1md3,/sbin/mdadm --detail --brief --test /dev/md3 &>/dev/null;echo "$?"

    Here is the output of debug on the server when it runs this command.
    Run remote command [/sbin/mdadm --detail --brief --test /dev/md3 &>/dev/null;echo $?] Result [1] [1]...
    3338:20130110:174423.113 Sending back [1]

    Hoping someone can point me in the right direction?
    Many thanks for any help to be had.

    Andre
  • Stephen Wood
    Member
    • Feb 2012
    • 43

    #2
    What happens when you give zabbix a shell and run the command manually?

    Code:
    usermod -s /bin/bash zabbix
    You also might be able to get the info you need by running

    Code:
    cat /proc/mdstat

    Comment

    • andre@andaff.com
      Junior Member
      • Jan 2013
      • 2

      #3
      thanks that was it, the command required root access and I was forgetting the userparameters run as zabbix. The correct exit code was being displayed...the command was failing

      Guess I will need to use proc...not what I wanted but it is readable by everyone.

      Thanks again
      You Rock!

      Andre

      Comment

      Working...