Index: modules/nagios/files/check_bandwidth |
=================================================================== |
--- a/modules/nagios/files/check_bandwidth |
+++ b/modules/nagios/files/check_bandwidth |
@@ -25,6 +25,8 @@ |
sys.exit(0) |
(warn, crit) = sys.argv[1:3] |
+ warn = int(sys.argv[1]) |
+ crit = int(sys.argv[2]) |
vnstat_output = subprocess.check_output(["vnstat", "-tr"]) |
(rx, rx_unit) = extract_data("rx", vnstat_output) |
@@ -37,12 +39,12 @@ |
output = "%s|%s" % (status, perfdata) |
- if warn <= rx or warn <= tx: |
+ if rx >= crit or tx >= crit: |
+ print "CRITICAL - " + output |
+ sys.exit(2) |
+ |
+ if rx >= warn or tx >= warn: |
print "WARNING - " + output |
sys.exit(1) |
- if crit <= rx or crit <= tx: |
- print "CRITICAL - " + output |
- sys.exit(2) |
- |
print "OK - " + output |