]> git.uio.no Git - uio-zabbix.git/commitdiff
Fix exception when get_default_gateway cannot get the hostname value of the gateway
authorRafael Martinez <r.m.guerrero@usit.uio.no>
Thu, 8 Jun 2017 11:08:21 +0000 (13:08 +0200)
committerRafael Martinez <r.m.guerrero@usit.uio.no>
Thu, 8 Jun 2017 11:08:21 +0000 (13:08 +0200)
get_default_gateway

index 6f7c59af02b1c052af5b33d9e149567d53081660..e963b502dca066d226ded70293112f6e018de3b9 100755 (executable)
@@ -12,5 +12,6 @@ def get_default_gateway_linux():
         
         return socket.inet_ntoa(struct.pack("<L", int(fields[2], 16)))
 
-print socket.gethostbyaddr(get_default_gateway_linux())[0]
+print socket.getfqdn(get_default_gateway_linux())
+