aboutsummaryrefslogtreecommitdiff
path: root/ping_tester
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2019-02-17 03:11:51 +0000
committerMike Crute <mike@crute.us>2019-02-17 03:11:51 +0000
commit667b5707f75836c59aa526a8dafd0b099366ef7c (patch)
treed73655601db178df8fe61e2a621c029f7737c06b /ping_tester
parent776709255538ac65188cc23d320d3141c03857e0 (diff)
downloaddockerfiles-667b5707f75836c59aa526a8dafd0b099366ef7c.tar.bz2
dockerfiles-667b5707f75836c59aa526a8dafd0b099366ef7c.tar.xz
dockerfiles-667b5707f75836c59aa526a8dafd0b099366ef7c.zip
ping_test: Don't error if ping fails
Diffstat (limited to 'ping_tester')
-rwxr-xr-xping_tester/ping_test.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/ping_tester/ping_test.py b/ping_tester/ping_test.py
index 6e19b3f..f6b7238 100755
--- a/ping_tester/ping_test.py
+++ b/ping_tester/ping_test.py
@@ -28,7 +28,12 @@ def main(sample_count=5):
28 ["ping", "-c", str(sample_count), hostname], 28 ["ping", "-c", str(sample_count), hostname],
29 stdout=subprocess.PIPE, stderr=subprocess.PIPE) 29 stdout=subprocess.PIPE, stderr=subprocess.PIPE)
30 30
31 val = patt.search(out.stdout.decode("us-ascii")).groupdict() 31 # Prevent failing with an error if the ping fails
32 match = patt.search(out.stdout.decode("us-ascii"))
33 if not match:
34 return 1
35
36 val = match.groupdict()
32 37
33 client.put_metric_data( 38 client.put_metric_data(
34 Namespace="VPNLatency", 39 Namespace="VPNLatency",
@@ -91,6 +96,8 @@ def main(sample_count=5):
91 ] 96 ]
92 ) 97 )
93 98
99 return 0
100
94 101
95if __name__ == "__main__": 102if __name__ == "__main__":
96 main() 103 sys.exit(main())