port dsa-check-memory to python3
[mirror/dsa-nagios.git] / dsa-nagios-checks / checks / dsa-check-memory
index e01f7d8..9b926b9 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # Copyright 2013 Stephen Gran
 #
@@ -45,7 +45,7 @@ elif options.mode == 'pct':
     options.warn = options.warn or 10
     options.crit = options.crit or 5
 else:
-    print "What mode is %s?" % options.mode
+    print("What mode is %s?" % options.mode)
     sys.exit(1)
 
 options.warn = int(options.warn)
@@ -72,21 +72,21 @@ used_mem = int(total_vm - avail_vm)
 
 if options.mode == 'pct':
     if free_pct < options.crit:
-        print "CRITICAL: Free VM: %d%%" % free_pct
+        print("CRITICAL: Free VM: %d%%" % free_pct)
         sys.exit(exit_codes['CRITICAL'])
     elif free_pct < options.warn:
-        print "WARNING: Free VM: %d%%" % free_pct
+        print("WARNING: Free VM: %d%%" % free_pct)
         sys.exit(exit_codes['WARNING'])
     else:
-        print "OK: Free VM: %d%%" % free_pct
+        print("OK: Free VM: %d%%" % free_pct)
         sys.exit(exit_codes['OK'])
 else:
     if avail_vm < options.crit:
-        print "CRITICAL: Free VM: %d" % avail_vm
+        print("CRITICAL: Free VM: %d" % avail_vm)
         sys.exit(exit_codes['CRITICAL'])
     elif avail_vm < options.warn:
-        print "WARNING: Free VM: %d" % avail_vm
+        print("WARNING: Free VM: %d" % avail_vm)
         sys.exit(exit_codes['WARNING'])
     else:
-        print "OK: Free VM: %d" % avail_vm
+        print("OK: Free VM: %d" % avail_vm)
         sys.exit(exit_codes['OK'])