port dsa-check-memory to python3
authorJulien Cristau <jcristau@debian.org>
Fri, 27 Sep 2019 13:26:55 +0000 (15:26 +0200)
committerJulien Cristau <jcristau@debian.org>
Fri, 27 Sep 2019 13:26:55 +0000 (15:26 +0200)
dsa-nagios-checks/checks/dsa-check-backuppg
dsa-nagios-checks/checks/dsa-check-memory
dsa-nagios-checks/debian/changelog

index 0784348..ce6a9a0 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python3
 
 # Copyright 2010 Peter Palfrader
 #
@@ -361,21 +361,21 @@ for dir in os.listdir('.'):
 
 
 for p in problems_seq:
-    print p
+    print(p)
 if options.verbose:
     for p in notices_seq:
-        print p
+        print(p)
 
 if options.expire:
     for f in global_expires:
-        if options.verbose: print "Expiring %s"%(f)
+        if options.verbose: print("Expiring %s" % f)
         if not options.dry_run: os.unlink(f)
 
 if len(problems_seq) > 0:
     sys.exit(1)
 
 if not options.expire or options.verbose:
-    print "OK: no problems detected"
+    print("OK: no problems detected")
 sys.exit(0)
 
 # vim:set et:
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'])
index e5ee2fa..7c6818f 100644 (file)
@@ -1,13 +1,15 @@
 dsa-nagios-checks (119) UNRELEASED; urgency=medium
 
   [ Peter Palfrader ]
-
   * dsa-check-raid-sw: correctly parse resync percentages under 10%.
   * Add check_puppetdb_nodes.
 
   [ Adam D. Barratt ]
   * dsa-check-soas: fix variable scoping
 
+  [ Julien Cristau ]
+  * port dsa-check-statusfile and dsa-check-memory to python3
+
  -- Peter Palfrader <weasel@debian.org>  Mon, 20 May 2019 12:52:00 +0200
 
 dsa-nagios-checks (118) unstable; urgency=medium