Module: check_mk
Branch: master
Commit: 2d278af967a45554e595a2f0e5dac49e263e952b
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2d278af967a455…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 6 11:03:18 2013 +0200
jar_signature: New check to monitor wether or not a jar is signed and certificate is not expired
---
ChangeLog | 2 +
agents/plugins/jar_signature | 45 ++++++++++++++++++++++
checks/jar_signature | 86 ++++++++++++++++++++++++++++++++++++++++++
3 files changed, 133 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index e6c07e1..dcc0a28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,8 @@
* oracle_asm_diskgroups: Added missing agent plugin + asmcmd wrapper script
* oracle_jobs: New check to monitor oracle database job execution
* oracle_rman_backups: New check to monitor state of ORACLE RMAN backups
+ * jar_signature: New check to monitor wether or not a jar is signed and
+ certificate is not expired
* cisco_qos: adhere qos-bandwidth policies
* check_disk_smb: WATO formalization for active check check_disk_smb
* if.include: new configurable parameters for assumed input and output speed
diff --git a/agents/plugins/jar_signature b/agents/plugins/jar_signature
new file mode 100755
index 0000000..76bb431
--- /dev/null
+++ b/agents/plugins/jar_signature
@@ -0,0 +1,45 @@
+#!/bin/bash
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+
+# This agent uses the program "jarsigner" to read ssl certificate
+# information of jar files and outputs the information to stdout
+# for the Check_MK check.
+# We assume that all files in the jar archive are signed with the
+# same certificate. So we only deal with the last signed file here.
+
+JAVA_HOME=/home/oracle/bin/jdk_latest_version
+JAR_PATH=/home/oracle/fmw/11gR2/as_1/forms/java/*.jar
+
+PATH=$JAVA_HOME/bin:$PATH
+
+echo "<<<jar_signature>>>"
+for JAR in $JAR_PATH; do
+ echo "[[[${JAR##*/}]]]"
+ OUTPUT=$(jarsigner -verify -verbose -certs "$JAR")
+ LINE=$(echo "$OUTPUT" | grep -n ^s | tail -n1 | cut -d: -f1)
+ echo "$(echo "$OUTPUT" | tail -n +$LINE)"
+ echo
+done
+
diff --git a/checks/jar_signature b/checks/jar_signature
new file mode 100644
index 0000000..2247d0d
--- /dev/null
+++ b/checks/jar_signature
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+
+import datetime, time
+
+def inventory_jar_signature(info):
+ inventory = []
+ for line in info:
+ if line[0].startswith("[[["):
+ f = line[0][3:-3]
+ inventory.append((f, {}))
+ return inventory
+
+def check_jar_signature(item, params, info):
+ in_block = False
+ details = []
+ in_cert = False
+ cert = []
+ for line in info:
+ line = (" ".join(line)).strip()
+ if line == "[[[%s]]]" % item:
+ in_block = True
+ elif in_block and line.startswith("[[["):
+ break
+ elif in_block and line.startswith("X.509"):
+ in_cert = True
+ cert = [line]
+ elif in_block and in_cert and line.startswith("[") and not line.startswith("[entry was signed on"):
+ in_cert = False
+ cert.append(line)
+ details.append(cert)
+
+ if not details:
+ return (2, "No certificate found")
+
+ cert_dn, cert_valid = details[0]
+
+ # [certificate is valid from 3/26/12 11:26 AM to 3/26/17 11:36 AM]
+ # [certificate will expire on 7/4/13 4:13 PM]
+ if "will expire on " in cert_valid:
+ to = cert_valid.split("will expire on ", 1)[1][:-1]
+ else:
+ to = cert_valid.split("to ", 1)[1][:-1]
+ to_dt = datetime.datetime(*time.strptime(to, '%m/%d/%y %I:%M %p')[:6])
+
+ warn, crit = 60, 30
+
+ state = 0
+ status_txt = ""
+ if to_dt < datetime.datetime.now() + datetime.timedelta(days = crit):
+ state = 2
+ status_txt = " (less than %d days)" % crit
+ elif to_dt < datetime.datetime.now() + datetime.timedelta(days = warn):
+ state = 1
+ status_txt = " (less than %d days)" % warn
+
+ return state, "Certificate expires on %s%s (%s)" % (to, status_txt, cert_dn)
+
+check_info['jar_signature'] = {
+ "service_description" : "Jar-Signature %s",
+ "check_function" : check_jar_signature,
+ "inventory_function" : inventory_jar_signature,
+}
Module: check_mk
Branch: master
Commit: 7bf4cbe44c403ac55acf4b3f91981df8e37d919a
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7bf4cbe44c403a…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 6 10:51:49 2013 +0200
oracle_rman_backups: New check to monitor state of ORACLE RMAN backups
---
ChangeLog | 1 +
agents/plugins/mk_oracle | 13 ++++++++
checkman/oracle_rman_backups | 21 ++++++++++++
checks/oracle_rman_backups | 72 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 107 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 2d17310..e6c07e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -54,6 +54,7 @@
* job: Monitoring states and performance indicators of any jobs on linux systems
* oracle_asm_diskgroups: Added missing agent plugin + asmcmd wrapper script
* oracle_jobs: New check to monitor oracle database job execution
+ * oracle_rman_backups: New check to monitor state of ORACLE RMAN backups
* cisco_qos: adhere qos-bandwidth policies
* check_disk_smb: WATO formalization for active check check_disk_smb
* if.include: new configurable parameters for assumed input and output speed
diff --git a/agents/plugins/mk_oracle b/agents/plugins/mk_oracle
index ae35dea..98a3604 100755
--- a/agents/plugins/mk_oracle
+++ b/agents/plugins/mk_oracle
@@ -180,6 +180,19 @@ for SID in $SIDS; do
EOF
fi
+ if [ '$EXCLUDE' = '${EXCLUDE/rman_backups/}' ]; then
+ echo '<<<oracle_rman_backups>>>'
+ sqlplus "$SID" <<EOF
+ SELECT b.COMMAND_ID, a.STATUS,
+ to_char(a.START_TIME, 'YYYY-mm-dd_HH24:MI:SS') AS START_TIME,
+ to_char(a.END_TIME, 'YYYY-mm-dd_HH24:MI:SS') AS END_TIME, b.INPUT_TYPE
+ FROM SYS.V_\\\$RMAN_BACKUP_JOB_DETAILS a,
+ (SELECT input_type, max(command_id) as command_id
+ FROM SYS.V_\\\$RMAN_BACKUP_JOB_DETAILS WHERE STATUS<>'RUNNING' GROUP BY input_type) b
+ WHERE a.COMMAND_ID = b.COMMAND_ID;
+EOF
+ fi
+
if [ '$EXCLUDE' = '${EXCLUDE/tablespaces/}' ]; then
echo '<<<oracle_tablespaces>>>'
sqlplus "$SID" <<EOF | sed 's/READ ONLY/READONLY/g'
diff --git a/checkman/oracle_rman_backups b/checkman/oracle_rman_backups
new file mode 100644
index 0000000..4c58d0a
--- /dev/null
+++ b/checkman/oracle_rman_backups
@@ -0,0 +1,21 @@
+title: Oracle RMAN Backups
+agents: linux
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors backup jobs configured with RMAN
+ (Recovery Manager) in ORACLE databases. It checks the state
+ of the last executed backup and outputs the execution times.
+
+ This check needs the Check_MK {mk_oracle}-plugin installed in
+ the agent. Please refer to the online documentation
+ for how to install that plugin.
+
+item:
+ The SID of the database (as appearing in the process
+ name of the pmon_... process) concatenated with the name
+ of the job separated by a single dot.
+
+inventory:
+ One separate check for each configured backup job will be created.
diff --git a/checks/oracle_rman_backups b/checks/oracle_rman_backups
new file mode 100644
index 0000000..e9f2fa5
--- /dev/null
+++ b/checks/oracle_rman_backups
@@ -0,0 +1,72 @@
+#!/usr/bin/python
+# -*- encoding: utf-8; py-indent-offset: 4 -*-
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+
+# <<<oracle_rman_backups>>>
+# IODBSZ1 2013-04-08T16:33:53 COMPLETED 2013-04-08_16:33:54 2013-04-08_17:56:42 DB FULL
+# IODBSZ1 2013-04-23T15:28:26 RUNNING 2013-04-23_15:28:28 2013-04-23_15:31:02 ARCHIVELOG
+
+def inventory_oracle_rman_backups(info):
+ inventory = []
+ for line in info:
+ inventory.append(("%s.%s" % (line[0], " ".join(line[5:])), {}))
+ return inventory
+
+def check_oracle_rman_backups(item, params, info):
+ try:
+ sid, jobname = item.split('.')
+ except ValueError:
+ return (3, 'Invalid check item given (must be <SID>.<job_name>)')
+
+ data = None
+ for line in info:
+ if line[0] == sid and " ".join(line[5:]) == jobname:
+ data = line
+ break
+ if not data:
+ return (3, 'Unable to find the job')
+
+ state = 0
+ output = []
+
+ job_state = line[2]
+
+ txt = "State: %s" % job_state
+ if job_state not in [ "COMPLETED", "RUNNING" ]:
+ txt += " (!!)"
+ state = max(state, 2)
+ output.append(txt)
+
+ output.append("Start-Time: %s" % line[3])
+ if job_state != "RUNNING":
+ output.append("End-Time: %s" % line[4])
+
+ return (state, ", ".join(output))
+
+check_info['oracle_rman_backups'] = {
+ "service_description" : "ORA %s RMAN Backup",
+ "check_function" : check_oracle_rman_backups,
+ "inventory_function" : inventory_oracle_rman_backups,
+}
Module: check_mk
Branch: master
Commit: 94b3b122d6bfc5150cce41c80691b985c7a74274
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=94b3b122d6bfc5…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 6 10:29:13 2013 +0200
oracle_asm_diskgroups: Added missing agent plugin + asmcmd wrapper script
---
ChangeLog | 1 +
agents/asmcmd.sh | 26 ++++++++++++++++++++++++++
agents/plugins/mk_oracle_asm | 38 ++++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+)
diff --git a/ChangeLog b/ChangeLog
index 5232a64..26c5507 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,7 @@
* openvpn_clients: new check for OpenVPN connections
* if64_tplink: special new check for TP Link switches with broken SNMP output
* job: Monitoring states and performance indicators of any jobs on linux systems
+ * oracle_asm_diskgroups: Added missing agent plugin + asmcmd wrapper script
* cisco_qos: adhere qos-bandwidth policies
* check_disk_smb: WATO formalization for active check check_disk_smb
* if.include: new configurable parameters for assumed input and output speed
diff --git a/agents/asmcmd.sh b/agents/asmcmd.sh
new file mode 100755
index 0000000..19d3c07
--- /dev/null
+++ b/agents/asmcmd.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2013 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-
+# ails. 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.
+
+su - griduser -c "asmcmd $@"
diff --git a/agents/plugins/mk_oracle_asm b/agents/plugins/mk_oracle_asm
new file mode 100755
index 0000000..1b02bd5
--- /dev/null
+++ b/agents/plugins/mk_oracle_asm
@@ -0,0 +1,38 @@
+#!/bin/bash
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 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-
+# ails. 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.
+
+# Check_MK agent plugin for monitoring ORACLE ASM
+
+if [ ! -e $MK_CONFDIR/asmcmd.sh ]; then
+ echo "$MK_CONFDIR/asmcmd.sh does not exist." >&2
+ exit 1
+fi
+
+function asmcmd () {
+ $MK_CONFDIR/asmcmd.sh $@
+}
+
+echo "<<<oracle_asm_diskgroup>>>"
+asmcmd lsdg | grep -v State | grep -v "The Oracle"
Module: check_mk
Branch: master
Commit: 1d026374a21f9bf72a5ac14c684bd3dcad4f2051
URL: http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=1d026374a21f9b…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon May 6 10:41:25 2013 +0200
Added manpage for new check
---
checkman/oracle_jobs | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/checkman/oracle_jobs b/checkman/oracle_jobs
new file mode 100644
index 0000000..2267d1f
--- /dev/null
+++ b/checkman/oracle_jobs
@@ -0,0 +1,25 @@
+title: Oracle Database Jobs
+agents: linux
+author: Lars Michelsen <lm(a)mathias-kettner.de>
+license: GPL
+distribution: check_mk
+description:
+ This check monitors jobs configured in ORACLE databases. It
+ monitors all enabled jobs wether or not their last execution
+ was successfull and the next execution is scheduled. It also
+ records the execution time of the jobs.
+
+ This check needs the Check_MK {mk_oracle}-plugin installed in
+ the agent. Please refer to the online documentation
+ for how to install that plugin.
+
+item:
+ The SID of the database (as appearing in the process
+ name of the pmon_... process) concatenated with the name
+ of the job separated by a single dot.
+
+perfdata:
+ One value: the duration of the last job execution in seconds.
+
+inventory:
+ One separate check for each enabled job will be created.