Initial commit.
This commit is contained in:
parent
0956898597
commit
3720f87dd2
BIN
agents/windows/plugins/pending_reboot.ps1
Normal file
BIN
agents/windows/plugins/pending_reboot.ps1
Normal file
Binary file not shown.
25
checkman/pending_reboot
Normal file
25
checkman/pending_reboot
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
title: Check for pending reboot state of Windows machines
|
||||||
|
agents: windows
|
||||||
|
catalog: os/windows
|
||||||
|
license: GPL
|
||||||
|
distribution:
|
||||||
|
description:
|
||||||
|
This check checks for machines in pending reboot.
|
||||||
|
You need to install the plugin {pending_reboot.ps1}
|
||||||
|
into the {plugins} directory of your windows agent.
|
||||||
|
This check was tested with Windows 2008 Server and Windows 7
|
||||||
|
and must have PowerShell installed. On Windows x64 is
|
||||||
|
recommended to use x64 agent. As always you must set
|
||||||
|
"set-executionpolicy remotesigned" on monitored host.
|
||||||
|
|
||||||
|
The check gets critical if the pending reboot status have 24
|
||||||
|
hours age and warning if the pending reboot status has more
|
||||||
|
than 12 hour age.
|
||||||
|
Both limits are definable in Wato under "Parameters for
|
||||||
|
Inventorized Checks", "Applications, Processes & Services".
|
||||||
|
|
||||||
|
inventory:
|
||||||
|
One service will be created for each host running the plugin.
|
||||||
|
|
||||||
|
perfdata:
|
||||||
|
None.
|
48
checks/pending_reboot
Normal file
48
checks/pending_reboot
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# Author: George Mocanu <george.mocanu@sphs.ro>
|
||||||
|
|
||||||
|
# EXAMPLE DATA FROM:
|
||||||
|
# fomat: pendingReboot 0 8
|
||||||
|
#
|
||||||
|
#<<<pending_reboot>>>
|
||||||
|
#pendingReboot 0 8
|
||||||
|
|
||||||
|
factory_settings["pending_reboot_default_values"] = {
|
||||||
|
"levels": (12, 24),
|
||||||
|
}
|
||||||
|
|
||||||
|
def inventory_pending_reboot(info):
|
||||||
|
inventory = []
|
||||||
|
for line in info:
|
||||||
|
checkName = line[0]
|
||||||
|
inventory.append( (checkName, {} ) )
|
||||||
|
return inventory
|
||||||
|
|
||||||
|
|
||||||
|
def check_pending_reboot(item, params, info):
|
||||||
|
if type(params) != dict:
|
||||||
|
params = { "levels": params }
|
||||||
|
warn, crit = params["levels"]
|
||||||
|
for line in info:
|
||||||
|
if line[0] == item:
|
||||||
|
status = int(line[1])
|
||||||
|
status_time = int(line[2])
|
||||||
|
if status == 1:
|
||||||
|
if status_time > crit:
|
||||||
|
return (2, "Computer in pending reboot for %d Hours" %status_time)
|
||||||
|
elif status_time > warn:
|
||||||
|
return (1, "Computer in pending reboot for %d Hours" %status_time)
|
||||||
|
else:
|
||||||
|
return (0, "Computer in pending reboot for %d Hours" %status_time)
|
||||||
|
else:
|
||||||
|
return (0, "Computer not expecting reboot")
|
||||||
|
return(3, "Plugin not running on host")
|
||||||
|
|
||||||
|
check_info["pending_reboot"] = {
|
||||||
|
"check_function" :check_pending_reboot,
|
||||||
|
"inventory_function" :inventory_pending_reboot,
|
||||||
|
"service_description" :"%s",
|
||||||
|
"default_levels_variable" :"pending_reboot_default_values",
|
||||||
|
"has_perfdata" :False,
|
||||||
|
"group" :"pending_reboot",
|
||||||
|
}
|
17
info
Normal file
17
info
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{'author': 'SpearHead Systems george.mocanu@sphs.ro',
|
||||||
|
'description': 'Pending reboot status check',
|
||||||
|
'download_url': 'https://github.com/spearheadsys/check_mk-pending_reboot',
|
||||||
|
'files': {'agents': ['windows/plugins/pending_reboot.ps1'],
|
||||||
|
'checkman': ['pending_reboot'],
|
||||||
|
'checks': ['pending_reboot'],
|
||||||
|
'doc': [],
|
||||||
|
'inventory': [],
|
||||||
|
'notifications': [],
|
||||||
|
'pnp-templates': [],
|
||||||
|
'web': ['plugins/wato/pending_reboot.py']},
|
||||||
|
'name': 'pending_reboot',
|
||||||
|
'num_files': 4,
|
||||||
|
'title': 'Package of pending_reboot check',
|
||||||
|
'version': '1.1',
|
||||||
|
'version.min_required': '1.2.6b5',
|
||||||
|
'version.packaged': '1.2.6b5'}
|
BIN
pending_reboot-1.1.mkp
Normal file
BIN
pending_reboot-1.1.mkp
Normal file
Binary file not shown.
32
web/plugins/wato/pending_reboot.py
Normal file
32
web/plugins/wato/pending_reboot.py
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#!/usr/bin/python
|
||||||
|
# 2015 george.mocanu@sphs.ro
|
||||||
|
|
||||||
|
register_check_parameters(
|
||||||
|
subgroup_applications,
|
||||||
|
"pending_reboot",
|
||||||
|
_("Windows Pending Reboot Status"),
|
||||||
|
Dictionary(
|
||||||
|
elements = [
|
||||||
|
("levels", # Name of your parameters
|
||||||
|
Tuple(
|
||||||
|
title = "Levels for pending reboot check", # Specify a title for this parameters
|
||||||
|
elements = [
|
||||||
|
Integer(
|
||||||
|
title = _("Warning if above"),
|
||||||
|
unit = _("Hours"),
|
||||||
|
default_value = 10
|
||||||
|
),
|
||||||
|
Integer(
|
||||||
|
title = _("Critical if above"),
|
||||||
|
unit = _("Hours"),
|
||||||
|
default_value = 20
|
||||||
|
),
|
||||||
|
]
|
||||||
|
)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
optional_keys = None, # Always show this subgroup
|
||||||
|
),
|
||||||
|
TextAscii( title = "Service name"),
|
||||||
|
"dict"
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user