integrations/nagios: Upgrade to argparse.
#!/usr/bin/env python
-import optparse
+import argparse
import zulip
from typing import List, Text, Dict, Any
@@ -8,14 +8,14 @@ VERSION = "0.9"
# Nagios passes the notification details as command line options.
# In Nagios, "output" means "first line of output", and "long
# output" means "other lines of output".
-parser = optparse.OptionParser() # type: optparse.OptionParser
-parser.add_option('--output', default='')
-parser.add_option('--long-output', default='')
-parser.add_option('--stream', default='nagios')
-parser.add_option('--config', default='/etc/nagios3/zuliprc')
+parser = zulip.add_default_arguments(argparse.ArgumentParser()) # type: argparse.ArgumentParser
+parser.add_argument('--output', default='')
+parser.add_argument('--long-output', default='')
+parser.add_argument('--stream', default='nagios')
+parser.add_argument('--config', default='/etc/nagios3/zuliprc')
for opt in ('type', 'host', 'service', 'state'):
- parser.add_option('--' + opt)
-(opts, args) = parser.parse_args() # type: Any, List[Text]
+ parser.add_argument('--' + opt)
+opts = parser.parse_args()
client = zulip.Client(config_file=opts.config,
client="ZulipNagios/" + VERSION) # type: zulip.Client
