Ad Widget

Collapse

Simple checks to expect data return

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skullone
    Member
    • Mar 2007
    • 46

    #1

    Simple checks to expect data return

    Hello all,
    Playing around with 1.6 now, upgraded from 1.4.x, loving escalations and repeat notifications.

    One thing I have revisited now is improving simple checks. For example, a simple check will see if port 143 is accepting connections for IMAP. If however, the IMAP server is having issues, it will still accept the connection, but will not print any data that normally goes with a new IMAP connection.
    Heres a good return via telnet:

    $ telnet localhost 143
    Trying 127.0.0.1...
    Connected to localhost.smarsh.com.
    Escape character is '^]'.
    * OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready


    Notice the hello string returned by the IMAP server, indicating it is accepting connections, and running correctly.
    Here is output when the IMAP server has 'hung'. The IMAP server is running, but in a bad state, still accepting connections, but not ready for data:

    $ telnet localhost 143
    Trying 127.0.0.1...
    Connected to localhost.smarsh.com.
    Escape character is '^]'.


    That is the extent of the connection. Port is open, and connection is accepted, but no data is exchanged, IMAP is not ready. Zabbix still considers this 'up', which in essence is true, the port is ready.

    I can check for local processes running IMAP, but they are running as well, there is no indication of an issue except the IMAP server does not "greet" connections with the header.

    Is there a way to 'expect' certain data be returned, so if the connection header doesn't come up, assume it's down?

    *Edit
    If you stop IMAP altogether, you obviously get:

    $ telnet localhost 143
    Trying 127.0.0.1...
    telnet: connect to address 127.0.0.1: Connection refused
    telnet: Unable to connect to remote host
    Last edited by skullone; 01-10-2008, 09:17.
  • skullone
    Member
    • Mar 2007
    • 46

    #2
    Bumping my old thread, this is still an issue for me.

    I looked at the source, and it appears Zabbix simply opens a TCP socket to a defined port, if the socket accepts, Zabbix assumes the service is up..

    My original post clarified this pretty much, but is this something that could be added? Or another module perhaps?

    Comment

    • alixen
      Senior Member
      • Apr 2006
      • 474

      #3
      You can use external scripts to do that.
      We use Nagios plugin "check_imap" with a shell wrapper to do that.

      This is a simplified version of the wrapper:
      Code:
      [FONT="Courier New"]#! /bin/sh
      host=$1
      shift
      plugin=$1
      shift
      res=`/usr/lib/nagios/plugins/check_$plugin -H $host $*`
      code=$?
      echo $code[/FONT]
      We create an item as:
      Type : external script
      Key : nagios_wrapper.sh[imap]

      Hope this helps

      Alixen
      http://www.alixen.fr/zabbix.html

      Comment

      Working...