From 3720f87dd201ee3cbf3f7ced96423b526758c654 Mon Sep 17 00:00:00 2001 From: George Mocanu Date: Mon, 2 Feb 2015 09:24:23 +0200 Subject: [PATCH] Initial commit. --- agents/windows/plugins/pending_reboot.ps1 | Bin 0 -> 7066 bytes checkman/pending_reboot | 25 +++++++++++ checks/pending_reboot | 48 ++++++++++++++++++++++ info | 17 ++++++++ pending_reboot-1.1.mkp | Bin 0 -> 3742 bytes web/plugins/wato/pending_reboot.py | 32 +++++++++++++++ 6 files changed, 122 insertions(+) create mode 100644 agents/windows/plugins/pending_reboot.ps1 create mode 100644 checkman/pending_reboot create mode 100644 checks/pending_reboot create mode 100644 info create mode 100644 pending_reboot-1.1.mkp create mode 100644 web/plugins/wato/pending_reboot.py diff --git a/agents/windows/plugins/pending_reboot.ps1 b/agents/windows/plugins/pending_reboot.ps1 new file mode 100644 index 0000000000000000000000000000000000000000..7f11804f3509985db5b3ef30c2921e81199c5fc3 GIT binary patch literal 7066 zcmeI1ZBGXR#V69D)CEZ+#=ruybzO9K)f($pZ~On< zGlzR;b_S3(zG^12Gxy;<{?Eg`{{7db@Fc8;<1h*n{T+sb@HE`e^Dw*#)9@<(y`$N_ zX7|HDZ_h&!R`l;l=!N&%HPxP%VJU3t_YZw7h5CANva;_d>t? zoksl&y}uFXJ?+2($D)9gL(znWYmAjmhe@gTM*QBFRR_^?kK(s!aanfpdGi`0J=tnC ztcxlZ>SVGqnEj$-b2J<3K?|hlYc2Y+wup9O?yW}0afRW~ zZLl5pnANcFk#?A!k2J$uvcDstT_V#sNyLsX^tg7vMn8^)X-E0CEVU*sj?F!-z|#9O zG8d&sY{xT2Pfu&$cu%^4!fknPpz*!%yGHs^|E_#7j5?ustRp6fNtJ3!dwXh`>*U_(F4}aV$EBUyePG zuAxSeco?o|7f}TIutYrrxEDe6^Jpca6fZsz63`o)lP3>FVJY+2QjCIJwx31g{Yfsx z0;9Obx!;mR#J8~HsEjJXUU5Zjq<2s167bI66FH0>52C?Mw zB77euxEdD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k7vo!l{ra_g5RjtJu!7W}zN&PWm`+lN6e##i$|p z)6m;o%aDb;GH#f-MWm{6vcDKI&mURWK3ilZPPwNXtN&GGB`*I*7XPpHZzC)B)kUIe Oxgo0D=N7Z(`F{XvO=Xt= literal 0 HcmV?d00001 diff --git a/checkman/pending_reboot b/checkman/pending_reboot new file mode 100644 index 0000000..b66e270 --- /dev/null +++ b/checkman/pending_reboot @@ -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. diff --git a/checks/pending_reboot b/checks/pending_reboot new file mode 100644 index 0000000..e44a23e --- /dev/null +++ b/checks/pending_reboot @@ -0,0 +1,48 @@ +#!/usr/bin/python +# Author: George Mocanu + +# EXAMPLE DATA FROM: +# fomat: pendingReboot 0 8 +# +#<<>> +#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", +} diff --git a/info b/info new file mode 100644 index 0000000..e753f18 --- /dev/null +++ b/info @@ -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'} diff --git a/pending_reboot-1.1.mkp b/pending_reboot-1.1.mkp new file mode 100644 index 0000000000000000000000000000000000000000..d06a58273b90b6c69a9b2dda3425e35816786e18 GIT binary patch literal 3742 zcmZveXE+-S)P_r|RipM^wOXa977Y@!R?OC_Jz~_1lo*j1^{U#XMOE!pTM24=Ys6>; zMXXY>MWR+yG4l1t_g&wg_s4n8bv=Kd=Q`&WNusBB7R6f9QUg5#+`R+5oS%ERL7~C2 z3UUf^{=R{ih>nDyc>{JF&b+yRB=T-xPRY`hX?FIGv}r9ayiM7(^WTnc*#+I}yqY|( z(fl!e>u2@Lj-l8sI@*P{{tkPb#)#hg?QJr!lwSfP6gFd{$K24`VYD1Qu!n$DxK0an zM5sli*adklS4|U6&1HRNF1u7|tFeAz0LnY)huWVP!=l)b^XQ6|Ax33;wNc3EjEBhsjz9JbrNkcSSMi7CX1cmpX4HgQ$ia`7etQb4i_WF6`7hF10Np_54)Luy=nr}=ykJinM&Z7L|mooMbzf}ty zeegAtKxkkpNx_o|f*nb8MI5OKf2K&NOZtq^n~lULD|y43ImRDt2;0Rw{jit|awW%5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6h$wrcs!?j&XOaR2r0w|C%feFBHx)^7gABQVM=B1+ zC+JKyy_&RY;cBt2VEIf1eOD5B%XbL-sou}?+;5Gv+6oz3#ks?yYK83eRu_W5LVHHY zqh#yJ2U;^#$AooV_3ckcgcN6nF0Mq6T_?9E}r4gRBA zzBw)!czM)b2~v0P_59Bgv5MBH-s0TzQIL-TXyXp5k$k2)#Ui!`DluzxO2NY(njGrI zXB^9((i7>-{TTGhxPHw#ADU9$qXS^Up zblJoDb?Zuj*B>&nf&G%)h5PLUWf$WeJc?IqN@-e3I?P<3k!a&;KPPb@F zIMz@y^mS*8e8iZGoZok*1RW%Di+|3y)^K%}dENYKS>_dQ_(bcl1%O!h@J+g!jqA=N z<8o11B!MiumcwJC(}D1pJmEJbEA2=fyG+J6RKcLtby?shsBye!T3trDFz6~yI8=Q| zWl*GmE3q>8V*#m3Z>ia|=wk%elSb?s=9l@gV8z?D%J2`Bfubv7zDcMp?E!7Rv=b8h bf8gVPGUfl9`(FJ~G+dVsu3s9ubm@Np(716N literal 0 HcmV?d00001 diff --git a/web/plugins/wato/pending_reboot.py b/web/plugins/wato/pending_reboot.py new file mode 100644 index 0000000..aed530b --- /dev/null +++ b/web/plugins/wato/pending_reboot.py @@ -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" +)