Skip to content

Implement python3 support #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions check_linux_metrics.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# File: check_linux_metrics.py
# URL: https://github.com/kxr/check_linux_metrics
Expand All @@ -25,6 +25,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import sys
import time
import os
Expand Down Expand Up @@ -112,7 +115,7 @@ def check_cpu( warn=None, crit=None ):
#update the interim file
shutil.copyfile( '/proc/stat', interim_file )

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_load( warn=None, crit=None ):
Expand Down Expand Up @@ -169,7 +172,7 @@ def check_load( warn=None, crit=None ):
#remove last space
perfdata = perfdata[:-1]

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_threads( warn=None, crit=None ):
Expand Down Expand Up @@ -213,7 +216,7 @@ def check_threads( warn=None, crit=None ):
#remove last space
perfdata = perfdata[:-1]

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_openfiles( warn=None, crit=None ):
Expand Down Expand Up @@ -260,7 +263,7 @@ def check_openfiles( warn=None, crit=None ):
#remove last space
perfdata = perfdata[:-1]

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )


Expand Down Expand Up @@ -371,7 +374,7 @@ def check_procs( warn=None, crit=None ):
#update the interim file
shutil.copyfile( '/proc/stat', interim_file )

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_diskio( dev, warn=None, crit=None ):
Expand Down Expand Up @@ -478,7 +481,7 @@ def check_diskio( dev, warn=None, crit=None ):
#update the interim file
shutil.copyfile( '/proc/diskstats', interim_file )

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_disku( mount, warn=None, crit=None):
Expand Down Expand Up @@ -526,7 +529,7 @@ def check_disku( mount, warn=None, crit=None):
if warn is not None and crit is not None:
perfdata += ';' + str(warn) + ';' + str(crit)

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_memory ( warn=None, crit=None ):
Expand Down Expand Up @@ -589,7 +592,7 @@ def check_memory ( warn=None, crit=None ):
#remove last space
perfdata = perfdata[:-1]

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )
def check_swap ( warn=None, crit=None ):
status_code = 3
Expand Down Expand Up @@ -645,7 +648,7 @@ def check_swap ( warn=None, crit=None ):
#remove last space
perfdata = perfdata[:-1]

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

def check_net ( interface, warn=None, crit=None ):
Expand Down Expand Up @@ -740,7 +743,7 @@ def check_net ( interface, warn=None, crit=None ):
#update the interim file
shutil.copyfile( '/proc/net/dev', interim_file )

print status_outp + ' | ' + perfdata
print ( status_outp + ' | ' + perfdata )
sys.exit( status_code )

if __name__ == '__main__':
Expand Down