Compare commits

..

18 commits

Author SHA1 Message Date
Sven Velt 4494a40822 Add README, new branch "main" 2020-12-27 13:41:45 +01:00
Sven Velt da318db5ec check_xbps.py: Hint to use "--sudo" 2017-11-09 12:29:07 +01:00
Sven Velt 2ad98cb81d check_xbps.py: run commands with sudo only when necessary 2016-12-26 22:58:47 +01:00
Sven Velt 7d476d9109 check_xbps.py: added "configure" package state 2016-12-26 22:58:22 +01:00
Sven Velt 21b7b687a0 check_xbps.py: Added --sudo
- "--sudo": Prepend all commands
- Improved error handling
2016-12-09 13:31:01 +01:00
Sven Velt 18c70c0a12 commands.cfg: Add commands for check_xbps.py 2016-11-24 21:11:47 +01:00
Sven Velt 3fefe3383b check_xbps: Catch "transaction aborted" error, return CRITICAL for updates
- Check return code of "xbps-install" call
- CRITICAL instead of WARNING when updates available
- Use return code from plugin class
2016-11-24 21:08:18 +01:00
Sven Velt 45f91ba985 check_xbps: add some verbose output 2016-11-24 21:08:09 +01:00
Sven Velt 95742e3d12 check_xbps: bugfix, re-add testmode switch 2016-11-24 21:07:59 +01:00
Sven Velt 6b8bd1c5eb check_xbps.py: New plugin for Voidlinux' package manager 2016-11-24 21:07:41 +01:00
Sven Velt 03e09061a5 Update URLs and copyright 2016-11-24 20:49:33 +01:00
Sven Velt bd5a2e6189 monitoringplugin.py: Update version string 2016-11-24 20:49:14 +01:00
Sven Velt b757d548e8 Update commands.cfg for release 2016-11-24 20:29:25 +01:00
Sven Velt c477c82587 check_cups: Add some verbose output 2016-11-24 19:55:36 +01:00
Sven Velt 2e4754e1ac Fixed multiline bug introduced in 925cbb2297 (brown paper bag, please) 2016-11-24 11:46:03 +01:00
Sven Velt e59b1a8c6e monitoringplugin.py: Enhance verbose output function
- one space per verbose level at the begining
- optional prefix (for list output)
- output lists one item per line
2016-11-11 17:38:43 +01:00
Sven Velt 925cbb2297 monitoringplugins.py: two multiline output fixes
- typo: saved with wrong key
- list may be a list of lists
2016-11-11 17:38:37 +01:00
Sven Velt 16364832dd check_cups.py: Correct timezone parsing 2016-10-12 12:23:21 +02:00
14 changed files with 243 additions and 71 deletions

30
README.md Normal file
View file

@ -0,0 +1,30 @@
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

@ -4,9 +4,12 @@
#####################################################################
# (c) 2007-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 "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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 #
@ -37,9 +40,10 @@ except ImportError:
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
print 'without "monitoringplugin.py"?\n'
print 'Please go back to'
print 'http://oss.teamix.org/projects/monitoringplugins/ and download it,'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a hole archive at http://oss.teamix.org/projects/monitoringplugins/files\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -42,7 +42,8 @@ except ImportError:
print 'Please go back to'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -23,7 +23,7 @@
# along with this file. If not, see <http://www.gnu.org/licenses/>. #
#####################################################################
import datetime
import os
import re
import subprocess
import sys
@ -59,41 +59,43 @@ plugin.add_cmdlineoption('-J', '--check-jobs', 'check_jobs', 'check job queue',
plugin.add_cmdlineoption('-w', '', 'warn', 'warning thresold for old jobs (seconds)', default='3600')
plugin.add_cmdlineoption('-c', '', 'crit', 'warning thresold for old jobs (seconds)', default='86400')
plugin.add_cmdlineoption('', '--mymontools-testmode', 'mymontools_testmode', None, default=False, action='store_true')
plugin.add_cmdlineoption('', '--mymonplugins-testmode', 'mymonplugins_testmode', None, default=False, action='store_true')
plugin.parse_cmdlineoptions()
##############################################################################
##### Testmode
if plugin.options.mymontools_testmode:
if plugin.options.mymonplugins_testmode:
# Because we need tzlocal from dateutil.tz
mymontools_testmode = {}
mymonplugins_testmode = {}
mymontools_testmode['lpstat -a'] = '''Printer_One accepting requests since 1970-01-01T00:00:00 CEST
Printer_Two accepting requests since 2016-01-01T00:00:00 CEST
Printer_Three accepting requests since 2116-01-01T00:00:00 CEST
Printer_Rejecting not accepting requests since 2016-02-01T00:00:00 CEST -
mymonplugins_testmode['lpstat -a'] = '''Printer_One accepting requests since Thu 16 Jun 2016 02:57:36 PM CEST
Printer_Two accepting requests since Thu 16 Jun 2016 02:57:36 PM CEST
Printer_Three accepting requests since Thu 16 Jun 2016 02:57:36 PM CEST
Printer_Rejecting not accepting requests since Thu 16 Jun 2016 02:57:36 PM CEST -
Rejecting Jobs'''.split('\n')
from dateutil.tz import tzlocal
mymontools_testmode['lpstat -o'] = '''Printer_One-1234 username 12345 1970-01-01T00:00:00 CEST
Printer_Two-1234 username 12345 %s''' % datetime.datetime.now(tzlocal()).strftime('%FT%T %Z')
mymontools_testmode['lpstat -o'] = mymontools_testmode['lpstat -o'].split('\n')
mymonplugins_testmode['lpstat -o'] = '''Printer_One-1234 username 12345 Thu 01 Jan 1970 01:07:19 AM CET
Printer_Two-1234 username 12345 %s''' % time.strftime('%a %d %b %Y %I:%M:%S %p %Z', time.localtime())
mymonplugins_testmode['lpstat -o'] = mymonplugins_testmode['lpstat -o'].split('\n')
##############################################################################
def check_printer_queue(output_printer_queue):
plugin.verbose(1, 'Checking printers')
lidx = 0
printers = []
printers_bad = []
while lidx < len(output_printer_queue):
printer = output_printer_queue[lidx].split(' ')[0]
plugin.verbose(2, 'Printer "%s"' % printer)
if output_printer_queue[lidx].find('not accepting') > 0:
reason = output_printer_queue[(lidx+1)].replace('\t', '').lstrip().rstrip()
printers_bad.append( (printer, reason,) )
lidx += 1
plugin.verbose(3, 'Problem: printer "%s", problem "%s"' % (printer, reason) )
printers.append( printer )
lidx += 1
@ -103,34 +105,31 @@ def check_printer_queue(output_printer_queue):
for p in printers_bad:
plugin.remember_check('%s' % p[0], 1, p[1])
##############################################################################
def check_job_queue(output_job_queue):
try:
import dateutil.parser
from dateutil.tz import tzlocal
except ImportError:
print('Python module "dateutil" required, please install!')
sys.exit(3)
m = re.compile('(\d{4}\D\d{2}\D\d{2}\D\d{2}\D\d{2}\D\d{2}\D\w{3,5})')
plugin.verbose(1, 'Checking job queue')
m = re.compile('(\w{3} \d\d \w{3} \d{4} \d\d:\d\d:\d\d (AM|PM) \w{3,5})')
nowsecs = long( time.time() )
jobs_warn = []
jobs_crit = []
for line in output_job_queue:
plugin.verbose(3, line)
f = m.search(line)
if not f:
plugin.verbose(1, 'No timestamp found in "%s"' % line)
continue
tstamp = dateutil.parser.parse(f.group(0))
tstamp = time.strptime(f.group(1), '%a %d %b %Y %I:%M:%S %p %Z')
tsecs = long( tstamp.strftime('%s') )
rc = plugin.value_wc_to_returncode((nowsecs-tsecs), plugin.options.warn, plugin.options.crit)
tsecs = long( time.mktime(tstamp) )
age = nowsecs - tsecs
rc = plugin.value_wc_to_returncode(age, plugin.options.warn, plugin.options.crit)
if rc == 1:
jobs_warn.append(line)
elif rc == 2:
jobs_crit.append(line)
plugin.verbose(1, 'Job is %s seconds old, state/returncode: %s' % (age, rc))
jobs = len(output_job_queue)
jobs_old = len(jobs_warn) + len(jobs_crit)
@ -147,11 +146,14 @@ def check_job_queue(output_job_queue):
##############################################################################
def call_cmd(cmdline):
if plugin.options.mymontools_testmode:
return (mymontools_testmode.get(' '.join(cmdline)), '', 0)
if plugin.options.mymonplugins_testmode:
return (mymonplugins_testmode.get(' '.join(cmdline)), '', 0)
myenv = dict(os.environ)
myenv['LC_ALL'] = 'C'
try:
cmd = subprocess.Popen(cmdline, stdout=subprocess.PIPE)
cmd = subprocess.Popen(cmdline, stdout=subprocess.PIPE, env=myenv)
(sout, serr) = cmd.communicate()
if sout:
sout = sout.lstrip().rstrip().split('\n')

View file

@ -1,10 +1,51 @@
#!/usr/bin/python
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from monitoringplugin import MonitoringPlugin
#####################################################################
# (c) 2006-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/>. #
#####################################################################
import fcntl
import socket
import struct
import sys
try:
from monitoringplugin import SNMPMonitoringPlugin
except ImportError:
print '=========================='
print 'AIKS! Python import error!'
print '==========================\n'
print 'Could not find "monitoringplugin.py"!\n'
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
print 'without "monitoringplugin.py"?\n'
print 'Please go back to'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)
def get_ipv4_address(iface):
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

View file

@ -40,7 +40,8 @@ except ImportError:
print 'Please go back to'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -4,9 +4,12 @@
#####################################################################
# (c) 2006-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 "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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 #
@ -35,9 +38,10 @@ except ImportError:
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
print 'without "monitoringplugin.py"?\n'
print 'Please go back to'
print 'http://oss.teamix.org/projects/monitoringplugins/ and download it,'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a hole archive at http://oss.teamix.org/projects/monitoringplugins/files\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -4,9 +4,12 @@
#####################################################################
# (c) 2005-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 "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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 #
@ -37,9 +40,10 @@ except ImportError:
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
print 'without "monitoringplugin.py"?\n'
print 'Please go back to'
print 'http://oss.teamix.org/projects/monitoringplugins/ and download it,'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a hole archive at http://oss.teamix.org/projects/monitoringplugins/files\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -4,9 +4,12 @@
#####################################################################
# (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 "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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 #
@ -36,9 +39,10 @@ except ImportError:
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
print 'without "monitoringplugin.py"?\n'
print 'Please go back to'
print 'http://oss.teamix.org/projects/monitoringplugins/ and download it,'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a hole archive at http://oss.teamix.org/projects/monitoringplugins/files\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -4,9 +4,12 @@
#####################################################################
# (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 "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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 #
@ -38,9 +41,10 @@ except ImportError:
print 'Did you download "%s"' % os.path.basename(sys.argv[0])
print 'without "monitoringplugin.py"?\n'
print 'Please go back to'
print 'http://oss.teamix.org/projects/monitoringplugins/ and download it,'
print 'https://gogs.velt.biz/velt.biz/MyMonPlugins and download it,'
print 'or even better:'
print 'get a hole archive at http://oss.teamix.org/projects/monitoringplugins/files\n'
print 'get a full archive at http://gogs.velt.biz/velt.biz/MyMonPlugins/releases'
print 'or a master snapshot at http://gogs.velt.biz/velt.biz/MyMonPlugins/archive/master.tar.gz\n'
sys.exit(127)

View file

@ -2,7 +2,7 @@
# -*- encoding: utf-8 -*-
#####################################################################
# (c) 2016 by Sven Velt, Germany #
# (c) 2016-2017 by Sven Velt, Germany #
# sven-mymonplugins@velt.biz #
# #
# This file is part of "velt.biz - My Monitoring Plugins" #
@ -54,6 +54,7 @@ plugin = MonitoringPlugin(
plugin.add_cmdlineoption('-P', '--path-xbps-install', 'xbps_install', 'full path to xbps-install', default='/usr/bin/xbps-install')
plugin.add_cmdlineoption('-S', '--sync-repo-index', 'sync_repo_index', 'sync repository index files at startup', default=False, action='store_true')
plugin.add_cmdlineoption('', '--ignore-sync-failure', 'fail_on_sync_failure', 'ignore repo index sync failures', default=True, action='store_false')
plugin.add_cmdlineoption('', '--sudo', 'sudo', 'call "xbps-install" with sudo', default=False, action='store_true')
plugin.add_cmdlineoption('', '--mymonplugins-testmode', 'mymonplugins_testmode', None, default=False, action='store_true')
@ -78,8 +79,12 @@ lxc-2.0.4_1 update x86_64 https://repo.voidlinux.eu/current 1837102 468024'''.sp
##############################################################################
def run_command(cmdline):
def run_command(cmdline, needs_sudo=False):
tstart = time.time()
if needs_sudo and plugin.options.sudo:
new = ['sudo', '-n', '--']
new.extend(cmdline)
cmdline = new
plugin.verbose(1, 'Running command line: %s' % subprocess.list2cmdline(cmdline))
try:
cmd = subprocess.Popen(
@ -107,12 +112,14 @@ def run_command(cmdline):
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)
(sout, serr, rc) = run_command(cmdline, needs_sudo=True)
sout and plugin.verbose(3, sout, prefix='stdout: ')
serr and plugin.verbose(3, serr, prefix='stderr: ')
plugin.verbose(2, 'Return code: %d' % rc)
if rc != 0 and plugin.options.fail_on_sync_failure:
plugin.back2nagios(plugin.RETURNCODE['CRITICAL'], 'Syncing of repository index files failed')
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)
##############################################################################
@ -122,6 +129,11 @@ 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.sudo and 'sudo: ' in ' '.join(serr):
# Running with sudo
if rc == 1:
# sudo RC 1: a password is required
plugin.back2nagios(plugin.RETURNCODE['CRITICAL'], ' '.join(serr))
if rc == 8:
# RC 8: Transaction aborted due to unresolved shlibs.
plugin.back2nagios(plugin.RETURNCODE['WARNING'], serr[-1], serr[:-1])
@ -130,7 +142,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':[],}
action = {'remove':[], 'update':[], 'install':[], 'configure':[]}
arch = {}
repo = {}
downby = 0L
@ -166,13 +178,13 @@ if len(sout) == 0:
else:
out = []
multiline = []
for act in ['update', 'install', 'remove']:
for act in ['update', 'install', 'remove', 'configure']:
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:
for act in action.keys():
pkgs = action.pop(act)
pkgs.sort()
l = len(pkgs)

View file

@ -3,9 +3,12 @@
#############################################################################
# (c) 2011 Sven Velt <sven@velt.de #
# and team(ix) GmbH, Nuernberg, Germany #
# (c) 2016 by Sven Velt, Germany #
# sven-mymonplugins@velt.biz #
# #
# This file is part of "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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/ #
# #
# All rights reserved. #
# Redistribution and use in source and binary forms, with or without #

View file

@ -1,4 +1,4 @@
# We use "$USER3" as user macro for path to teamix monitoring plugins
# We use "$USER3" as user macro for path to MyMonPlugins
### check_apaches.py
@ -7,13 +7,45 @@ define command {
command_name check_apaches
command_line $USER3$/check_apaches.py -H $HOSTADDRESS$ -w $ARG1$ -c $ARG3$
}
# check_command check_apaches_full
# check_command check_apaches_full!https!webserver!443!/hidden-status!user:password!40!70
define command {
command_name check_apaches_full!https!webserver!443!/hidden-status!user:password!40!70
command_name check_apaches_full
command_line $USER3$/check_apaches.py -P $ARG1$ -H $ARG2$ -p $ARG3$ -u $ARG4$ -a $ARG5$ -w $ARG6$ -c $ARG7$
}
### check_collectd.py (WIP!)
# check_command check_collectd!load/load!2!5
## $USER17$ contains the path to collectd's unixsock (e.g. "/var/run/collectd-unixsock")
define command {
command_name check_collectd
command_line $USER3$/check_collectd.py -S $USER17$ -H $HOSTNAME$ -V $ARG1$ -w $ARG2$ -c $ARG3$
# command_line $USER3$/check_collectd.py -S $USER17$ -H $HOSTALIAS$ -V $ARG1$ -w $ARG2$ -c $ARG3$
}
# Use "__collectd_name" in host definition if collectd's hostname differs from object host name
define command {
command_name check_collectd
command_line $USER3$/check_collectd.py -S $USER17$ -H $_HOST_COLLECTD_NAME$ -V $ARG1$ -w $ARG2$ -c $ARG3$
}
### check_cups.py
# check_command check_cups
define command {
command_name check_cups
command_line $USER3$/check_cups.py
}
# check_command check_cups_jobs
define command {
command_name check_cups_jobs
command_line $USER3$/check_cups.py --check-jobs
}
# check_command check_cups_printers
define command {
command_name check_cups_printers
command_line $USER3$/check_cups.py --check-printers
}
### check_iface-dns.py
# check_command check_iface-dns!ppp0!your-name.dyndns.org,other-name.homeip.net
define command {
@ -22,8 +54,19 @@ define command {
}
### check_junos_bgp.pl
### check_junos_vc.pl
### check_livestatus_latency.py
# check_command check_livestatus_latency
## $USER18$ contains the path to your livestatus socket
define command {
command_name check_livestatus_latency
command_line $USER3$/check_livestatus_latency.py
# command_line $USER3$/check_livestatus_latency.py -S $USER18$
}
# check_command check_livestatus_latency!10!20
define command {
command_name check_livestatus_latency
command_line $USER3$/check_livestatus_latency.py -w $ARG1$ -c $ARG2$
}
### check_naf.py
@ -57,7 +100,6 @@ define command {
}
### check_sensors.py
# check_command check_sensors!20000,20001!16:20!14:24!40:60!30:70
define command {
@ -76,6 +118,19 @@ define command {
}
### check_xbps.py
# check_command check_xbps
define command {
command_name check_xbps
command_line $USER3$/check_xbps.py
}
# check_command check_xbps
define command {
command_name check_xbps_syncrepoindex
command_line $USER3$/check_xbps.py -S
}
### check_zypper.sh
# check_command check_zypper
define command {
@ -83,3 +138,4 @@ define command {
command_line $USER3$/check_zypper.sh
}

View file

@ -4,9 +4,12 @@
#####################################################################
# (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 "team(ix) Monitoring Plugins" #
# URL: http://oss.teamix.org/projects/monitoringplugins/ #
# 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 #
@ -22,7 +25,7 @@
# along with this file. If not, see <http://www.gnu.org/licenses/>. #
#####################################################################
__version__ = '0.0.110715'
__version__ = '0.0.161124'
__all__ = ['MonitoringPlugin', 'SNMPMonitoringPlugin']
import datetime, optparse, os, re, sys
@ -405,7 +408,10 @@ class MonitoringPlugin(object):
if type(multiline) == str:
out += '\n' + multiline.replace('|', ' ')
elif type(multiline) in [list, tuple]:
if type(multiline[0]) in [list, tuple]:
out += '\n' + '\n'.join([item for sublist in multiline for item in sublist]).replace('|', ' ')
else:
out += '\n' + '\n'.join(multiline).replace('|', ' ')
# Check if there's perfdata
if performancedata: