Changeset 22635 for platform/nagios-plugins
- Timestamp:
- 11/03/08 19:44:56 (5 years ago)
- Files:
-
- 1 modified
-
platform/nagios-plugins/check_memcached.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
platform/nagios-plugins/check_memcached.py
r22634 r22635 2 2 ''' 3 3 4 200 7Kakikubo Teruo5 check_memcache .py4 2008 Kakikubo Teruo 5 check_memcached.py 6 6 7 7 Check Memcached Server plugin. … … 9 9 This Plugin was tested only in the python 2.5 10 10 11 * Wed Apr 2 20:42:56 JST 2008 12 add performance data (elapsed time) 13 11 14 ''' 12 15 import memcache 13 16 import signal 17 import time 14 18 import os,sys 15 19 … … 17 21 18 22 pid = str(os.getpid()) 23 19 24 # option 20 25 parser = OptionParser() … … 35 40 svr = str(opts.hostaddress) + ":" + str(opts.port) 36 41 mc = memcache.Client([ svr ], debug=0) 37 #mc = memcache.Client({opts.hostaddress}:{opts.port}, debug=1)38 #mc = memcache.Client(["ocnblg-tc01-int:112"], debug=1)39 42 40 43 def handler(signum, frame): 41 #print 'Signal handler called with signal', signum42 #raise IOError, "hogehogehgoehgoe"43 44 print "CRITICAL - timeout after " + str(opts.timeout) + " seconds" 44 45 sys.exit(2) 45 46 46 ## Set the signal handler47 47 signal.signal(signal.SIGALRM, handler) 48 48 signal.alarm(int(opts.timeout)) 49 t1 = time.time() 49 50 50 51 if not mc.set(pid,"nagios value"): … … 57 58 else: 58 59 mc.delete(pid) 59 print "OK - memcached alive" 60 t2 = time.time() 61 t3 = str(round((t2 - t1),6)) 62 print "OK - memcached on " + str(opts.hostaddress) + " alive: elapsed " + t3 + " sec;|" + str(opts.hostaddress) + ":" + str(opts.port) + " time=" + t3 + "s;" 60 63 sys.exit(0) 61 64
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)