Compare commits

..

No commits in common. "main" and "1.0a1" have entirely different histories.
main ... 1.0a1

2 changed files with 7 additions and 39 deletions

View file

@ -1,30 +0,0 @@
MyMonPlugins
This is the old master branch! New development takes place in the "main" branch!
Default branch will change in the near future.
---
(c) 2010-2011 by Sven Velt and team(ix) GmbH, Nuernberg, Germany
sv@teamix.net
(c) 2016 by Sven Velt, Germany
sven-mymonplugins@velt.biz
This file is part of "velt.biz - My Monitoring Plugins"
a fork of "team(ix) Monitoring Plugins" in 2015
URL: https://gogs.velt.biz/velt.biz/MyMonPlugins/
This file is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
by the Free Software Foundation, either version 2 of the License,
or (at your option) any later version.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this file. If not, see <http://www.gnu.org/licenses/>.

View file

@ -2,7 +2,7 @@
# -*- encoding: utf-8 -*-
#####################################################################
# (c) 2016-2017 by Sven Velt, Germany #
# (c) 2016 by Sven Velt, Germany #
# sven-mymonplugins@velt.biz #
# #
# This file is part of "velt.biz - My Monitoring Plugins" #
@ -79,9 +79,9 @@ lxc-2.0.4_1 update x86_64 https://repo.voidlinux.eu/current 1837102 468024'''.sp
##############################################################################
def run_command(cmdline, needs_sudo=False):
def run_command(cmdline):
tstart = time.time()
if needs_sudo and plugin.options.sudo:
if plugin.options.sudo:
new = ['sudo', '-n', '--']
new.extend(cmdline)
cmdline = new
@ -112,13 +112,11 @@ def run_command(cmdline, needs_sudo=False):
if plugin.options.sync_repo_index:
plugin.verbose(1, '-S/--sync_repo_index given')
cmdline = [plugin.options.xbps_install, '-S',]
(sout, serr, rc) = run_command(cmdline, needs_sudo=True)
(sout, serr, rc) = run_command(cmdline)
sout and plugin.verbose(3, sout, prefix='stdout: ')
serr and plugin.verbose(3, serr, prefix='stderr: ')
plugin.verbose(2, 'Return code: %d' % rc)
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)
##############################################################################
@ -142,7 +140,7 @@ elif rc not in [0, 6]:
# RC 6: Package(s) already installed
plugin.back2nagios(plugin.RETURNCODE['WARNING'], 'Unknown returncode "%s", please contact the author of plugin or open an issue!' % rc)
action = {'remove':[], 'update':[], 'install':[], 'configure':[]}
action = {'remove':[], 'update':[], 'install':[],}
arch = {}
repo = {}
downby = 0L
@ -178,13 +176,13 @@ if len(sout) == 0:
else:
out = []
multiline = []
for act in ['update', 'install', 'remove', 'configure']:
for act in ['update', 'install', 'remove']:
pkgs = action.pop(act)
pkgs.sort()
l = len(pkgs)
out.append('%s package%s to %s' % (l, l != 1 and 's' or '', act) )
l and multiline.append('%s(%s): %s' % (act, l, ', '.join(pkgs)) )
for act in action.keys():
for act in action:
pkgs = action.pop(act)
pkgs.sort()
l = len(pkgs)