Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: modules/nagios/files/check_bandwidth

Issue 29458590: Noissue - Use parameter for network interface in the check_bandwidth nagios plugin (Closed)
Patch Set: Created June 7, 2017, 12:38 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | modules/nagios/templates/nrpe.cfg.erb » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: modules/nagios/files/check_bandwidth
===================================================================
--- a/modules/nagios/files/check_bandwidth
+++ b/modules/nagios/files/check_bandwidth
@@ -18,12 +18,13 @@
# family name and 6 bytes actual MAC address).
s = socket.socket()
SIOCGIFHWADDR = 0x8927 # see man ioctl_list
- return fcntl.ioctl(s.fileno(), SIOCGIFHWADDR, struct.pack("24s", "eth0"))[18:24]
+ NIC = str(sys.argv[3])
mathias 2017/06/07 15:27:22 This shouldn't be an upper-case name (I think the
+ return fcntl.ioctl(s.fileno(), SIOCGIFHWADDR, struct.pack("24s", NIC))[18:24]
if __name__ == "__main__":
- if len(sys.argv) != 3:
+ if len(sys.argv) != 4:
script_name = os.path.basename(sys.argv[0])
- print "Usage: %s WARN CRIT" % script_name
+ print "Usage: %s WARN CRIT NIC" % script_name
sys.exit(0)
(warn, crit) = sys.argv[1:3]
« no previous file with comments | « no previous file | modules/nagios/templates/nrpe.cfg.erb » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld