2 # -*- encoding: utf-8; py-indent-offset: 4 -*-
3 # +------------------------------------------------------------------+
4 # | ____ _ _ __ __ _ __ |
5 # | / ___| |__ ___ ___| | __ | \/ | |/ / |
6 # | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
7 # | | |___| | | | __/ (__| < | | | | . \ |
8 # | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
10 # | Copyright Mathias Kettner 2014 mk@mathias-kettner.de |
11 # +------------------------------------------------------------------+
13 # This file is part of Check_MK.
14 # The official homepage is at http://mathias-kettner.de/check_mk.
16 # check_mk is free software; you can redistribute it and/or modify it
17 # under the terms of the GNU General Public License as published by
18 # the Free Software Foundation in version 2. check_mk is distributed
19 # in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
20 # out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
21 # PARTICULAR PURPOSE. See the GNU General Public License for more de-
22 # tails. You should have received a copy of the GNU General Public
23 # License along with GNU Make; see the file COPYING. If not, write
24 # to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
25 # Boston, MA 02110-1301 USA.
27 # <<<oracle_rman_backups>>>
28 # IODBSZ1 2013-04-08T16:33:53 COMPLETED 2013-04-08_16:33:54 2013-04-08_17:56:42 DB FULL
29 # IODBSZ1 2013-04-23T15:28:26 RUNNING 2013-04-23_15:28:28 2013-04-23_15:31:02 ARCHIVELOG
32 def inventory_oracle_rman_backups(info
):
35 if line
[1] != "FAILURE" and " ".join(line
[5:]) in ('ARCHIVELOG', 'DB FULL', 'DB INCR'):
36 inventory
.append(("%s.%s" % (line
[0], " ".join(line
[5:])), {}))
40 def check_oracle_rman_backups(item
, params
, info
):
42 sid
, jobname
= item
.split('.')
44 return (3, 'Invalid check item given (must be <SID>.<job_name>)')
48 if line
[0] == sid
and " ".join(line
[5:]) == jobname
:
52 return (3, 'Unable to find the job')
59 txt
= "State: %s" % job_state
60 if job_state
not in ["COMPLETED", "RUNNING"]:
65 output
.append("Start-Time: %s" % data
[3])
66 if job_state
!= "RUNNING":
67 output
.append("End-Time: %s" % data
[4])
69 return (state
, ", ".join(output
))
72 check_info
['oracle_rman_backups'] = {
73 "service_description": "ORA %s RMAN Backup",
74 "check_function": check_oracle_rman_backups
,
75 "inventory_function": inventory_oracle_rman_backups
,