Nagios/Icinga Plugin output improvements
* Do not longer print "YUM <status>: " in the Nagios/Icinga plugin output. This change was made gor the reasons of, and following my own proposal at http://sourceforge.net/tracker/?func=detail&aid=3572875&group_id=29880&atid=397597 , which already got consent by at lead developers from at least Nagios. * If there is no performance data, do not print "|" in the Nagios/Icinga plugin output. Currently, check_yum never gives performance data output anyway and even if this would be the case, there may be statuses for which no performance data is applicable (typically when the status would be UNKNOWN). As this simplyfies parsing of the plugin output by Nagios/Icinga, it seemed useful.
This commit is contained in:
parent
8066a05f6d
commit
38442b4731
12
check_yum
12
check_yum
@ -27,21 +27,21 @@ from optparse import OptionParser
|
||||
DEFAULT_TIMEOUT = 30
|
||||
|
||||
|
||||
def end(status, message, perfdata=''):
|
||||
def end(status, message, perfdata=""):
|
||||
"""Exits the plugin with first arg as the return code and the second arg as the message to output."""
|
||||
|
||||
check = "YUM "
|
||||
if perfdata:
|
||||
print "%s | %s" % (message, perfdata)
|
||||
else:
|
||||
print "%s" % message
|
||||
|
||||
if status == OK:
|
||||
print "%sOK: %s | %s" % (check, message, perfdata)
|
||||
sys.exit(OK)
|
||||
elif status == WARNING:
|
||||
print "%sWARNING: %s | %s" % (check, message, perfdata)
|
||||
sys.exit(WARNING)
|
||||
elif status == CRITICAL:
|
||||
print "%sCRITICAL: %s | %s" % (check, message, perfdata)
|
||||
sys.exit(CRITICAL)
|
||||
else:
|
||||
print "UNKNOWN: %s" % message
|
||||
sys.exit(UNKNOWN)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user