Ad Widget

Collapse

result always 0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Biobabar
    Junior Member
    • Jan 2011
    • 15

    #1

    result always 0

    Hello !
    I have a problem with system.run.
    I have always a result at 0 !
    It's command line not usual. With command line usual, it's perfect (example : find, ps ...) but with command line HP it's not same (example : hplog, hpacucli).
    normaly my command :

    shell > hpacucli ctrl all show config
    Smart Array P400 in Slot 1 (sn: PAFGK0K9VVZ36D)
    array A (SAS, Unused Space: 0 MB)
    logicaldrive 1 (68.3 GB, RAID 1, OK)
    physicaldrive 2I:1:1 (port 2I:box 1:bay 1, SAS, 72 GB, OK)
    physicaldrive 2I:1:2 (port 2I:box 1:bay 2, SAS, 72 GB, OK)
    array B (SAS, Unused Space: 0 MB)
    logicaldrive 2 (136.7 GB, RAID 1, OK)
    physicaldrive 1I:1:7 (port 1I:box 1:bay 7, SAS, 146 GB, OK)
    physicaldrive 1I:1:8 (port 1I:box 1:bay 8, SAS, 146 GB, OK)
    array C (SAS, Unused Space: 0 MB)
    logicaldrive 3 (136.7 GB, RAID 1, OK)
    physicaldrive 1I:1:5 (port 1I:box 1:bay 5, SAS, 146 GB, OK)
    physicaldrive 1I:1:6 (port 1I:box 1:bay 6, SAS, 146 GB, OK)
    array D (SAS, Unused Space: 0 MB)
    logicaldrive 4 (136.7 GB, RAID 1, OK)
    physicaldrive 2I:1:3 (port 2I:box 1:bay 3, SAS, 146 GB, OK)
    physicaldrive 2I:1:4 (port 2I:box 1:bay 4, SAS, 146 GB, OK)

    I want monitoring my raid system. So Normally :

    shell > hpacucli ctrl all show config | grep OK -c
    12

    But with system.run[hpacucli ctrl all show config | grep OK -c], I have always 0 in return.
    The user zabbix don't have correct rights by default. I add "zabbix ALL=NOPASSWD:/usr/sbin/hpacucli" in /etc/sudoer
    I have always 0 in return.

    I have tested with userparameter in zabbix_agentd.conf, it's the same.
    Help me please
    Last edited by Biobabar; 01-03-2011, 15:20.
  • marcel
    Senior Member
    Zabbix Certified Specialist
    • Oct 2010
    • 112

    #2
    try using quotes around the command line ("") and use full paths to all commands used (including grep)

    marcel
    Zabbix Certified Specialist for Large Environments since 12/2010

    Comment

    • Biobabar
      Junior Member
      • Jan 2011
      • 15

      #3
      Thank you for your answer.
      I have try with :

      system.run[sudo /usr/sbin/hpacucli ctrl all show config | /bin/grep "OK" -c,wait]
      system.run["sudo /usr/sbin/hpacucli ctrl all show config | /bin/grep OK -c",wait]

      It's the same but it's ok in my system.
      I don't understand why it's different between command line in the system and system.run...

      Comment

      • Biobabar
        Junior Member
        • Jan 2011
        • 15

        #4
        I have already use system.run:
        system.run[ps -ef | grep "adonix -a -s 1802 -l FRA GFTEST" -c]
        It's good
        and in my zabbix_agentd.conf, I have try Userparameter and it's good too.
        Only the command "hpacucli" don't work.
        can I change the account zabbix in root ? for a test ?

        Comment

        • Biobabar
          Junior Member
          • Jan 2011
          • 15

          #5
          How to test the output on the bad command
          Thank you

          Comment

          • marcel
            Senior Member
            Zabbix Certified Specialist
            • Oct 2010
            • 112

            #6
            check the zabbix agent and server log file, also make sure 'sudo' is in the path or provide full link to the command

            also i think sudo needs the full command line with parameters, not just the command in the definition

            marcel
            Zabbix Certified Specialist for Large Environments since 12/2010

            Comment

            • Biobabar
              Junior Member
              • Jan 2011
              • 15

              #7
              OK, I added /usr/bin/sudo for sudo but it's the same.
              However with the log I have a new information !

              Mar 2 08:40:23 gfc-sv-oracl-3 sudo: zabbix : sorry, you must have a tty to run sudo ; TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/sbin/hplog -p

              It soon good, I search...

              Comment

              • Biobabar
                Junior Member
                • Jan 2011
                • 15

                #8
                It's good !!

                In /etc/sudoer, I have unselected "Defaults requiretty" with a "#"

                Thank you very much for your help

                Comment

                • marcel
                  Senior Member
                  Zabbix Certified Specialist
                  • Oct 2010
                  • 112

                  #9
                  great! enjoy zabbix!
                  Zabbix Certified Specialist for Large Environments since 12/2010

                  Comment

                  Working...