Ad Widget

Collapse

External script quit working after reboot

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bmclaughlin
    Junior Member
    • Oct 2008
    • 10

    #1

    External script quit working after reboot

    I wrote a pretty simple external script to check SMTP status on a remote server.... Worked fine (returned 1 for service up) for a week till I rebooted the zabbix machine for software updates, now Zabbix shows 0 or no result from it, and keeps disabling the item.

    script:

    Code:
    (
    echo "quit"
    ) | telnet xxx.xxx.xxx.xxx 25 2>/dev/null | grep 220 > /dev/null 2>&1
    if [ "$?" -ne "1" ]; then #Ok
      echo "1"
    else #Connection failure
        echo "0"
    fi
    date >> /etc/zabbix/externalscripts/SMTPcheck.log
    How do I go about troubleshooting this? If I run the script manually it returns a 1 as it should.
  • bmclaughlin
    Junior Member
    • Oct 2008
    • 10

    #2
    I'm really stuck on this and could use some help.

    If I run the script manually as either root or user 'zabbix' it works. However, when zabbix runs the script it fails. (Added more logging to see that it's actually running it, and that it's succeeding or not)

    Now what?

    Comment

    • alixen
      Senior Member
      • Apr 2006
      • 474

      #3
      Hi,

      I don't have a solution but you could get more information by sending telnet output and errors to your log file instead of /dev/null.

      Hope this helps
      Alixen
      http://www.alixen.fr/zabbix.html

      Comment

      • Crazy Marty
        Member
        • Sep 2007
        • 75

        #4
        Either explicitly set $PATH before any lines of the script are executed, or refer to any/all programs by their full pathnames.

        Comment

        • richlv
          Senior Member
          Zabbix Certified Trainer
          Zabbix Certified SpecialistZabbix Certified Professional
          • Oct 2005
          • 3112

          #5
          a few more things :
          1. when checking scripts, run them as 'su - zabbix';

          2. see item configuration for that item, there might be an error visible;

          3. there actually is a built-in smtp service check which should do something very similar and be slightly more efficient
          Zabbix 3.0 Network Monitoring book

          Comment

          • bmclaughlin
            Junior Member
            • Oct 2008
            • 10

            #6
            Thanks for your help guys. On richlv's prompting I revisited the simple check and was able to get it working...

            Simple checks would be a lot easier if the documentation on them was actually correct. Or a single working example would have helped, as well.

            I do wish I could figure out why the original script quit working... But I'll leave that for another day when I need something similar that can't be done via simple check.

            Comment

            • richlv
              Senior Member
              Zabbix Certified Trainer
              Zabbix Certified SpecialistZabbix Certified Professional
              • Oct 2005
              • 3112

              #7
              could you point out where documentation is wrong ?
              Zabbix 3.0 Network Monitoring book

              Comment

              • bmclaughlin
                Junior Member
                • Oct 2008
                • 10

                #8
                From the documentation:
                Originally posted by Zabbix 1.6 documentation pdf
                4.10.5.Simple checks
                Simple checks
                Simple checks are normally used for agent-less monitoring or for remote checks
                of services. Note that ZABBIX Agent is not needed for simple checks. ZABBIX
                Server is responsible for processing of simple checks (making external
                connections, etc).
                All simple check accepts two optional parameters:
                ip - IP address. Dafult value is 127.0.0.1
                port - Port number. If missing, standard default service port is used.
                Examples of using simple checks:

                ftp,127.0.0.1,155
                http,11.22.33.44
                http_perf,11.22.33.44,8080

                If you do these you get an error 'too many parameters' or something similar in the logs. That's because the first parameter is added automatically from the 'host' entry... The first time I set it up I dropped the item into a different host entry (Why make a host, group, etc for only a single check I wanted to do on a server on the internet?)... and it wouldn't ever work.

                lots of brain damage and wasted time over inaccurate documentation.

                Comment

                • richlv
                  Senior Member
                  Zabbix Certified Trainer
                  Zabbix Certified SpecialistZabbix Certified Professional
                  • Oct 2005
                  • 3112

                  #9
                  that indeed was a critical documentation problem, thanks for pointing out. it's fixed in trunk documentation at http://www.zabbix.com/documentation/...#simple_checks

                  btw, bugreports about documentation are welcome both in the tracker and as comments to the documentation
                  Zabbix 3.0 Network Monitoring book

                  Comment

                  Working...