Ad Widget

Collapse

UserParameter returns nothing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • akbar415
    Senior Member
    • May 2015
    • 119

    #1

    UserParameter returns nothing

    I create a small script to do tnsping through Zabbix.


    Code:
    #!/bin/bash
    
    instance=$1
    
    tnsping=/opt/app/oracle/product/11.2.0/client_1/bin/tnsping
    
    var1=$($tnsping $instance)
    var2=$(echo $var1 |grep -Eoh '[0-9]* msec' |grep -Eoh '*[0-9]*')
    
    echo $var2
    In zabbix agent I set it up:

    UserParameter=tnsping[*],/opt/scripts/pingOracle.sh $1

    If I run /sbin/zabbix_agentd -t tnsping[ORACLE1]

    I get
    Code:
    tnsping[ORACLE1]  [t|15240]
    But from zabbix server running zabbix_get -s servername -k tnsping[ORACLE1] I get a empty response.

    TImeout in zabbix server and agent is 30.

    Click image for larger version  Name:	Capturar.PNG Views:	1 Size:	4.9 KB ID:	359468


    Zabbix agent log

    Code:
      1681:20180530:104959.716 Requested [tnsping[ORACLE1]]
      1681:20180530:104959.716 In zbx_popen() command:'/opt/scripts/pingOracle.sh ORACLE1'
      1681:20180530:104959.716 End of zbx_popen():7
      1713:20180530:104959.716 zbx_popen(): executing script
      1681:20180530:104959.728 In zbx_waitpid()
      1681:20180530:104959.728 zbx_waitpid() exited, status:0
      1681:20180530:104959.728 End of zbx_waitpid():1713
      1681:20180530:104959.728 EXECUTE_STR() command:'/opt/scripts/pingOracle.sh ORACLE1' len:0 cmd_result:''
      1681:20180530:104959.728 Sending back []







    Last edited by akbar415; 30-05-2018, 15:56.
  • Atsushi
    Senior Member
    • Aug 2013
    • 2028

    #2
    Even if the Timeout setting is extended to 30 seconds, processing that takes more time can not be acquired with UserParameter.

    For example, please periodically run it with cron etc., output it to a file, and specify UserParameter to get only the result value from that file.

    Comment

    • akbar415
      Senior Member
      • May 2015
      • 119

      #3
      Originally posted by Atsushi
      Even if the Timeout setting is extended to 30 seconds, processing that takes more time can not be acquired with UserParameter.

      For example, please periodically run it with cron etc., output it to a file, and specify UserParameter to get only the result value from that file.
      I timed the comand (/sbin/zabbix_agentd -t tnsping[ORACLE1]) and take 10 seconds, in the worst case, to receive a empty answer, futhermore when is Timeout problem zabbix show the message "timeout while executing a shell script".

      Comment

      • aib
        Senior Member
        • Jan 2014
        • 1615

        #4
        Sometimes zabbix_agent cannot provide information to zabbix_server because of not sufficient permissions to start scripts/processes. Change log level to debug on agent side, restart agent, and repeat zabbix_get command on server side. Then check zabbix_agent.log file to be sure that there are no error messages.
        Sincerely yours,
        Aleksey

        Comment

        • akbar415
          Senior Member
          • May 2015
          • 119

          #5
          Originally posted by aib
          Sometimes zabbix_agent cannot provide information to zabbix_server because of not sufficient permissions to start scripts/processes. Change log level to debug on agent side, restart agent, and repeat zabbix_get command on server side. Then check zabbix_agent.log file to be sure that there are no error messages.
          I update my question with the log in debug mode.

          Comment

          • aib
            Senior Member
            • Jan 2014
            • 1615

            #6
            Do you have any chance to log the execution of TNSPING? From your debug log I assume that tnsping did not start or throw an error message which was filtered out by pipe of grep's
            One more option, do you mind temporarily change pingOracle script? For example, change "echo $var2" to "echo $var1" to see the full message from tnsping...
            Sincerely yours,
            Aleksey

            Comment

            Working...