Module: check_mk
Branch: master
Commit: a5f4430a065498891e80f0bd12f8a5957e27b0f7
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a5f4430a065498…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri Feb 12 10:33:29 2016 +0100
#2982 solaris_services.summary: new check which gives a summary of services provided by
SMF on Solaris
---
.werks/2982 | 9 ++++
ChangeLog | 1 +
agents/check_mk_agent.solaris | 9 ++++
checkman/solaris_services.summary | 22 +++++++++
checks/solaris_services | 83 ++++++++++++++++++++++++++++++++++
web/plugins/wato/check_parameters.py | 18 ++++++++
6 files changed, 142 insertions(+)
diff --git a/.werks/2982 b/.werks/2982
new file mode 100644
index 0000000..9ecfa45
--- /dev/null
+++ b/.werks/2982
@@ -0,0 +1,9 @@
+Title: solaris_services.summary: new check which gives a summary of services provided by
SMF on Solaris
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1455269547
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index c306b1b..fcf5832 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -117,6 +117,7 @@
* 2979 aruba_wlc_aps: new inventory plugin for Aruba Networks WLAN Controller which
displays name, group name, model, serial number and system location of all access points
of this WLC
* 2980 agent_ipmi_sensors: new special agent to monitor IPMI data via ipmi-sensors
(of freeipmi)...
* 2981 isc_dhcpd: added leases path /var/lib/dhcpd/dhcpd.leases for CentOS
+ * 2982 solaris_services.summary: new check which gives a summary of services provided
by SMF on Solaris
* 2660 FIX: fixed windows agent using the wrong working directory...
* 2664 FIX: ps: Speedup in situation with many matching processes...
* 2661 FIX: windows agent: fixed incomplete process list...
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index d3e674b..d226755 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -327,6 +327,15 @@ then
fmadm faulty
fi
+# Getting Information About Services Running on Solaris
+# We can get a list of all service instances, including disabled
+# or incomplete ones by 'svcs -a'
+if type svcs > /dev/null 2>&1
+then
+ echo '<<<solaris_services>>>'
+ svcs -a
+fi
+
# MK's Remote Plugin Executor
if test -f "$MK_CONFDIR/mrpe.cfg"
then
diff --git a/checkman/solaris_services.summary b/checkman/solaris_services.summary
new file mode 100644
index 0000000..77bc68c
--- /dev/null
+++ b/checkman/solaris_services.summary
@@ -0,0 +1,22 @@
+title: SMF Solaris: Services Summary
+agents: solaris
+catalog: os/services
+license: GPL
+distribution: check_mk
+description:
+ This check gives a summary of the solaris services provided by
+ the Service Management Facility command 'svcs -a'.
+ The check reports the number of all services and for each service
+ type, i.e. 'online', 'disabled', 'legacy_run',
'maintenance' and
+ other ones.
+ You can configure the status of the services of type
+ 'maintenance'.
+
+item:
+ No item.
+
+perfdata:
+ No performance data.
+
+Inventory:
+ One service is created
diff --git a/checks/solaris_services b/checks/solaris_services
new file mode 100644
index 0000000..766f0fc
--- /dev/null
+++ b/checks/solaris_services
@@ -0,0 +1,83 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2016 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk 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 in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# tails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+
+
+# <<<solaris_services>>>
+# STATE STIME FMRI
+# legacy_run Jun_14 lrc:/etc/rcS_d/S99openconnect-clean
+# legacy_run Jun_14 lrc:/etc/rc2_d/S47pppd
+# legacy_run Jun_14 lrc:/etc/rc2_d/S81dodatadm_udaplt
+# legacy_run Jun_14 lrc:/etc/rc2_d/S89PRESERVE
+# disabled Jun_14 svc:/system/device/mpxio-upgrade:default
+# disabled Jun_14 svc:/network/install:default
+# disabled Jun_14 svc:/network/ipfilter:default
+# disabled Jun_14 svc:/network/ipsec/ike:default
+# disabled Jun_14 svc:/network/ipsec/manual-key:default
+# disabled Jun_14 svc:/system/name-service-cache:default
+# disabled Jun_14 svc:/network/ldap/client:default
+# disabled Jun_14 svc:/network/nis/client:default
+# disabled Jun_14 svc:/network/ibd-post-upgrade:default
+# disabled Jun_14 svc:/network/inetd-upgrade:default
+# disabled Jun_14 svc:/network/nfs/status:default
+# disabled Jun_14 svc:/network/nfs/nlockmgr:default
+# online Jun_14 svc:/system/zones:default
+# online Jun_14 svc:/system/power:default
+# online Jun_14 svc:/system/hal:default
+# online Jun_14 svc:/application/texinfo-update:default
+# online Jun_14 svc:/application/pkg/update:default
+# maintenance Jul_09 svc:/network/smtp:sendmail
+
+
+def inventory_solaris_services_summary(info):
+ return [ (None, {}) ]
+
+
+def check_solaris_services_summary(_no_item, params, info):
+ collected_services = {}
+ if len(info) >= 1:
+ for line in info[1:]:
+ collected_services.setdefault(line[0], [])
+ collected_services[line[0]].append(line[2])
+
+ yield 0, "%d services" % (len(info) - 1)
+
+ for srv_type, srv_names in collected_services.items():
+ state = 0
+ extra_info = ""
+ if srv_type == "maintenance":
+ if params.get("maintenance_state", 0):
+ extra_info += " (%s)" % ", ".join(srv_names)
+ state = params["maintenance_state"]
+
+ yield state, "%d %s%s" % (len(srv_names),
srv_type.replace("_", " "), extra_info)
+
+
+check_info['solaris_services.summary'] = {
+ 'inventory_function' : inventory_solaris_services_summary,
+ 'check_function' : check_solaris_services_summary,
+ 'service_description' : 'SMF Services Summary', # Service Management
Facility
+ 'group' : 'solaris_services_summary',
+}
diff --git a/web/plugins/wato/check_parameters.py b/web/plugins/wato/check_parameters.py
index 42942a4..5126988 100644
--- a/web/plugins/wato/check_parameters.py
+++ b/web/plugins/wato/check_parameters.py
@@ -4692,6 +4692,24 @@ register_check_parameters(
register_check_parameters(
subgroup_applications,
+ "solaris_services_summary",
+ _("Solaris Services Summary"),
+ Dictionary(
+ title = _('SMF Services'),
+ elements = [
+ ('maintenance_state',
+ MonitoringState(
+ title = _("State if 'maintenance' services are
found"),
+ default_value = 0,
+ )),
+ ],
+ ),
+ None,
+ "dict"
+)
+
+register_check_parameters(
+ subgroup_applications,
"esx_vsphere_objects",
_("State of ESX hosts and virtual machines"),
Dictionary(