Ad Widget

Collapse

script that uses java in UserParameter not work when get error messages

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cberni
    Junior Member
    • Apr 2013
    • 19

    #1

    script that uses java in UserParameter not work when get error messages

    I have the userparameter:
    UserParameter=dicom.echo,/opt/dicom_echo.sh

    The dicom_echo.sh:
    Code:
    #!/bin/bash
    /opt/dcm4che2/bin/dcmecho [email protected]:11112 -L XXXXX >& /dev/null
    echo $?
    This echo show 0 if OK and NOT 0 if PROBLEM.

    When returning 0 all things work right:
    - console in server:
    root@zabbix-server:~# zabbix_get -s zabbix.agent -p 10050 -k "dicom.echo"
    0
    - console in agent:
    root@zabbix-agent:# zabbix_agentd -t dicom.echo
    dicom.echo [t|0]

    BUT when returning NOT 0 we got the problem:
    - console in server:
    root@zabbix-server:~# zabbix_get -s zabbix.agent -p 10050 -k "dicom.echo"
    ZBX_NOTSUPPORTED

    - console in agent:
    root@zabbix-agent:# zabbix_agentd -t dicom.echo
    dicom.echo Alarm clock


    When java get the error in stderr the script put it in /dev/null (>&) and returns only a number not 0. But zabbix-agent appears don't recognized it. Any idea?
    Last edited by cberni; 30-04-2013, 18:00.
  • Heilig
    Senior Member
    Zabbix Certified Trainer
    Zabbix Certified SpecialistZabbix Certified Professional
    • Mar 2013
    • 366

    #2
    Are you sure that there is only a number (and no other characters or spaces)?
    What mistake Zabbix shows when you move mouse in a column error for this item?

    Comment

    • cberni
      Junior Member
      • Apr 2013
      • 19

      #3
      sure that have only the number.

      don't get any error there: http://postimg.org/image/6wszozu51/


      after a while showed a error: "Get value from agent failed: ZBX_TCP_READ() failed: [4] Interrupted system call"
      But I don't know if is about this problem (see next image link): http://postimg.org/image/aaz36an81/
      Last edited by cberni; 30-04-2013, 19:59. Reason: add information

      Comment

      • cberni
        Junior Member
        • Apr 2013
        • 19

        #4
        if I comment the lines in the script and put just "echo 2" I get it right:
        zabbix_agentd -t dicom.echo
        dicom.echo [t|2]

        and not that "Alarm clock"


        to be sure that is only printing the number I did:

        Code:
        #!/bin/bash
        /opt/dcm4che2/bin/dcmecho [email protected]:11122 -L XXXXX >& /dev/null
        
        if [[ $? -eq 0 ]]; then
            echo 0
        else
            echo 2
        fi
        when "echo 2" get the problem. "echo 0" is ok.

        the problem seems to be on the line: "/opt/dcm4che2/bin/dcmecho [email protected]:11122 -L XXXXX >& /dev/null"
        Last edited by cberni; 30-04-2013, 19:30.

        Comment

        • cberni
          Junior Member
          • Apr 2013
          • 19

          #5
          the big picture is:

          when the script get a error and use stderr.
          If the script use stderr show the error described above. Does anybody could tell me way?

          Comment

          • cberni
            Junior Member
            • Apr 2013
            • 19

            #6
            solved.

            the problem was because the script take too long time to finish when got problems. the scrip needs about 5 seconds.

            The option Timeout (Spend no more than Timeout seconds on processing) is the set as 3 by default. I changed it to 10 and than I didn't get the "Alarm clock" anymore.

            Comment

            • jefersoncb
              Junior Member
              • Apr 2020
              • 1

              #7
              Hello, sorry to be activating the post again, but I have not found any other solution to obtain monitoring in a DICOM environment. Would you have the complete script and how was it used? I tried using your script with the dcm4chee package, but I didn't get good results.

              Comment

              Working...