check_xbps.py: Hint to use "--sudo"

This commit is contained in:
Sven Velt 2017-11-09 12:29:07 +01:00
parent 2ad98cb81d
commit da318db5ec

View file

@ -2,7 +2,7 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
##################################################################### #####################################################################
# (c) 2016 by Sven Velt, Germany # # (c) 2016-2017 by Sven Velt, Germany #
# sven-mymonplugins@velt.biz # # sven-mymonplugins@velt.biz #
# # # #
# This file is part of "velt.biz - My Monitoring Plugins" # # This file is part of "velt.biz - My Monitoring Plugins" #
@ -117,6 +117,8 @@ if plugin.options.sync_repo_index:
serr and plugin.verbose(3, serr, prefix='stderr: ') serr and plugin.verbose(3, serr, prefix='stderr: ')
plugin.verbose(2, 'Return code: %d' % rc) plugin.verbose(2, 'Return code: %d' % rc)
if plugin.options.fail_on_sync_failure and (rc != 0 or 'ERROR:' in ' '.join(serr)): if plugin.options.fail_on_sync_failure and (rc != 0 or 'ERROR:' in ' '.join(serr)):
if 'Permission denied' in ' '.join(serr):
plugin.back2nagios(plugin.RETURNCODE['CRITICAL'], 'Syncing of repository index files failed, permission denied. Do you need "--sudo"?', multiline=serr)
plugin.back2nagios(plugin.RETURNCODE['CRITICAL'], 'Syncing of repository index files failed', multiline=serr) plugin.back2nagios(plugin.RETURNCODE['CRITICAL'], 'Syncing of repository index files failed', multiline=serr)
############################################################################## ##############################################################################