mandriva

Ticket #589 (closed enhancement: fixed)

Opened 3 years ago

Last modified 3 years ago

Nagios script to monitor launchers and schedulers

Reported by: cdelfosse Owned by: cdelfosse
Priority: Lower Milestone: 1.2.1
Component: general Version: 1.2.0
Severity: Minor Keywords:
Cc:

Description


Attachments

Change History

Changed 3 years ago by oroussy

  • owner changed from oroussy to cdelfosse

Changed 3 years ago by cdelfosse

#!/usr/bin/python

import sys
import getopt
from xmlrpclib import ServerProxy, Error
import socket

OK = 0
WARNING = 1
CRITICAL = 2
UNKNOWN = 3

def usage():
    print "Usage: pulse2-check -u http[s]://username:password@host:port"
    sys.exit(UNKNOWN)

def main():
    try:
        opts, args = getopt.getopt(sys.argv[1:], "u:")
    except getopt.GetoptError, e:
        print str(e)
        usage()
        sys.exit(3)

    url = None
    for o, a in opts:
        if o in ('-u',):
            url = a
        else:
            usage()

    if not url:
        usage()

    s = ServerProxy(url)

    try:
        health = s.get_health()
    except Error, e:
        print str(e)
        sys.exit(3)
    except socket.error, e:
        code, msg = e.args
        if code == 111:
            print msg
        else:
            print str(e)
        sys.exit(CRITICAL)

    if 'fd' in health and 'loadavg' in health and 'memory' in health:
        print "OK"
        sys.exit(OK)
    else:
        print "WARNING: " + str(health)
        sys.exit(WARNING)


if __name__ == "__main__":
    main()

Changed 3 years ago by cdelfosse

  • status changed from new to closed
  • resolution set to fixed

Add/Change #589 (Nagios script to monitor launchers and schedulers)

Author



Action
as closed
Next status will be 'reopened'
 
Note: See TracTickets for help on using tickets.