summaryrefslogtreecommitdiffstats
path: root/tests/monitor.py
diff options
context:
space:
mode:
authorRyota MIBU <r-mibu@cq.jp.nec.com>2016-02-12 21:05:48 +0900
committerRyota MIBU <r-mibu@cq.jp.nec.com>2016-02-12 22:02:37 +0900
commit3c09b82d0ead86867f96f43769a6b42efcdd6d24 (patch)
treecd692a5cfc6771065a59e2364c9b49389779a07d /tests/monitor.py
parent12cbbc40ff05812b3d44ff76e9156a84f4c18944 (diff)
tests: enable doctor test scenario with fixes
Change-Id: I2c0c939b41f28684a1697b0099f2df62ce27c6a3 Signed-off-by: Ryota MIBU <r-mibu@cq.jp.nec.com>
Diffstat (limited to 'tests/monitor.py')
-rw-r--r--tests/monitor.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/monitor.py b/tests/monitor.py
index 953ef09b..bc22b1ea 100644
--- a/tests/monitor.py
+++ b/tests/monitor.py
@@ -28,10 +28,11 @@ class DoctorMonitorSample(object):
def __init__(self, args):
self.hostname = args.hostname
self.inspector = args.inspector
- self.ip_addr = socket.gethostbyname(self.hostname)
+ self.ip_addr = args.ip or socket.gethostbyname(self.hostname)
def start_loop(self):
- print "start ping to host %s" % self.hostname
+ print "start ping to host %(h)s (ip=$(i)s)" % {'h': self.hostname,
+ 'i': self.ip_addr}
sock = socket.socket(socket.AF_INET, socket.SOCK_RAW,
socket.IPPROTO_ICMP)
sock.settimeout(self.timeout)
@@ -57,6 +58,8 @@ def get_args():
parser = argparse.ArgumentParser(description='Doctor Sample Monitor')
parser.add_argument('hostname', metavar='HOSTNAME', type=str, nargs='?',
help='a hostname to monitor connectivity')
+ parser.add_argument('ip', metavar='IP', type=str, nargs='?',
+ help='an IP address to monitor connectivity')
parser.add_argument('inspector', metavar='INSPECTOR', type=str, nargs='?',
help='inspector url to report error',
default='http://127.0.0.1:12345/events')