Lars Hansson committed 77e7dbe Draft

Remove -a option.

To scan all services and submit passive checks just dont list
any services on the command-line.

Comments (0)

Files changed (1)

 def handle_options():
-    usage = "Usage: %prog <-H hostname> [options] service"
+    usage = "Usage: %prog <-H hostname> [options] [service]"
     version = '%prog 0.1'
     parser = OptionParser(usage=usage, version=version)
     parser.add_option("-H", dest="host", help="Hostname or IP address")
                         help="Socket timeout in seconds (Default: %default)")
     parser.add_option("-u", dest="username", default=None, help="Username")
     parser.add_option("-p", dest="password", default=None, help="Password")
-    parser.add_option("-a", dest="checkall", action="store_true", default=False, help="Check all services and submit passive results")
-    parser.add_option("-f", dest="cmdfile", default=None, help="Nagios command file")
-    parser.add_option("-n", dest="host_name", default=None, help="Nagios host_name")
+    parser.add_option("-f", dest="cmdfile", default='/var/lib/nagios/rw/nagios.cmd', help="Nagios command file (Default: %default)")
+    parser.add_option("-n", dest="host_name", default='localhost', help="Nagios host_name (Default: %default)")
     (opts, args) = parser.parse_args()
-    if (not or (opts.checkall and opts.cmdfile is None):
+    if not
     return (opts, args)
     """Main loop"""
     (opts, args) = handle_options()
-    if not opts.checkall:
-        svc = args[0]
     proto = 'http'
     if opts.ssl:
         proto = 'https'
     statusdoc = get_status(url, opts.username, opts.password, opts.timeout)
     statusdoc = statusdoc.replace("&", "&amp;")
-    if opts.checkall:
+    if len(args) == 0:
         r = process_status_all(statusdoc)
         submit_results(r, opts)
         code = 0
         msg = 'Data collected from monit daemon.'
-        (code, msg, perf_data) = process_status(svc, statusdoc)
+        (code, msg, perf_data) = process_status(args[0], statusdoc)
     do_exit(code, msg, perf_data)