aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-07-04 09:30:05 +0200
committerGuido Günther <agx@sigxcpu.org>2014-07-04 09:30:05 +0200
commitc44943bcb2b0a3089eb40a8235ac37724ec33016 (patch)
treefe49fa081cedd0f32057d48b82251079f4aaad53
parent9f59b064ba5f2e94b6dfa7e213fd3f0654f544e8 (diff)
Support multiple switchesHEADmaster
-rw-r--r--dnssc.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/dnssc.py b/dnssc.py
index d288c0d..61b96a8 100644
--- a/dnssc.py
+++ b/dnssc.py
@@ -58,9 +58,11 @@ def mac_to_string(mac):
def main(argv):
port = 64514
parser = OptionParser(usage='%prog [options]')
- parser.add_option("--switch-ip", dest="switchip",
- default='10.90.90.90',
- help="IP of the switch to monitor")
+ parser.add_option("--switch-ip", dest="switchips",
+ metavar='ADDRESS',
+ default=['10.90.90.90'],
+ action='append',
+ help="IPv4 address of the switch to monitor")
(options, args) = parser.parse_args(argv[1:])
sock = socket.socket(socket.AF_INET,
@@ -69,7 +71,7 @@ def main(argv):
while True:
data, addr = sock.recvfrom(1024)
- if addr[0] == options.switchip:
+ if addr[0] in options.switchips:
msg = SmartConsoleMsg.from_data(data)
print """Event on %s
Model: %s