Skip to content

Commit a8c096f

Browse files
committed
Added custom pnp4nagios templates.
1 parent ef639fd commit a8c096f

File tree

4 files changed

+135
-2
lines changed

4 files changed

+135
-2
lines changed

SNMP-readme.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,10 +372,11 @@ Así pues resumiendo lo expuesto encima hemos creado los ficheros::
372372
~/lib/nagios/plugins/check_enviromux_mini
373373
~/etc/nagios/conf.d/inigo/enviromux.cfg
374374

375-
De momento no lo hacemos pero si nos intersa modificar la gráfica que general el template ``default.php``::
375+
Para modificar la gráfica que general el template ``default.php`` nos basamos en dos que tiene check_mk por defecto (en ``~/share/check_mk/pnp-templates/`` ) para un sensor de humedad/temperatura, concretamente ``check_mk-akcp_sensor_humidity.php`` y ``check_mk-akcp_sensor_temp.php`` ::
376376

377377
~/etc/pnp4nagios/check_commands/check_enviromux_mini.cfg
378-
~/etc/pnp4nagios/templates/{}
378+
~/etc/pnp4nagios/templates/check_enviromux_mini_temperature1.php
379+
~/etc/pnp4nagios/templates/check_enviromux_mini_humidity1.php
379380

380381

381382
check_mk checks

nagios/check_enviromux_mini.cfg

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#
2+
# Adapt the Template if check_command should not be the PNP Template
3+
#
4+
# check_command check_nrpe!check_all_local_disks
5+
# ________0__________| |
6+
# ________1________________________|
7+
#
8+
# User ARG1
9+
CUSTOM_TEMPLATE = 0,1
10+
#
11+
# Change the RRD Datatype based on the check_command Name.
12+
# Defaults to GAUGE.
13+
#
14+
# Adjust the whole RRD Database
15+
# DATATYPE = COUNTER
16+
#
17+
# Adjust every single DS by using a List of Datatypes.
18+
# DATATYPE = GAUGE,GAUGE,COUNTER,COUNTER
19+
20+
# Use the MIN value for newly created RRD Databases.
21+
# This value defaults to 0
22+
# USE_MIN_ON_CREATE = 1
23+
#
24+
# Use the MAX value for newly created RRD Databases.
25+
# This value defaults to 0
26+
# USE_MAX_ON_CREATE = 1
27+
28+
# Use a single RRD Database per Service
29+
# This Option is only used while creating new RRD Databases
30+
#
31+
# RRD_STORAGE_TYPE = SINGLE
32+
#
33+
# Use multiple RRD Databases per Service
34+
# One RRD Database per Datasource.
35+
# RRD_STORAGE_TYPE = MULTIPLE
36+
#
37+
# RRD_STORAGE_TYPE = SINGLE
38+
39+
# RRD Heartbeat in seconds
40+
# This Option is only used while creating new RRD Databases
41+
# Existing RRDs can be changed by "rrdtool tune"
42+
# More on http://oss.oetiker.ch/rrdtool/doc/rrdtune.en.html
43+
#
44+
# This value defaults to 8640
45+
# RRD_HEARTBEAT = 305
46+
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?php
2+
# +------------------------------------------------------------------+
3+
# | ____ _ _ __ __ _ __ |
4+
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
5+
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6+
# | | |___| | | | __/ (__| < | | | | . \ |
7+
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
8+
# | |
9+
# | Copyright Mathias Kettner 2010 [email protected] |
10+
# +------------------------------------------------------------------+
11+
#
12+
# This file is part of Check_MK.
13+
# The official homepage is at http://mathias-kettner.de/check_mk.
14+
#
15+
# check_mk is free software; you can redistribute it and/or modify it
16+
# under the terms of the GNU General Public License as published by
17+
# the Free Software Foundation in version 2. check_mk is distributed
18+
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19+
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20+
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21+
# ails. You should have received a copy of the GNU General Public
22+
# License along with GNU Make; see the file COPYING. If not, write
23+
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24+
# Boston, MA 02110-1301 USA.
25+
26+
# +------------------------------------------------------------------+
27+
# | This file has been contributed by: |
28+
# | |
29+
# | Michael Nieporte <[email protected]> |
30+
# +------------------------------------------------------------------+
31+
32+
$opt[1] = "--vertical-label \"Percent\" --title \"$servicedesc\" ";
33+
34+
$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
35+
$def[1] .= "LINE2:var1#2080ff:\"Humidity\:\" ";
36+
$def[1] .= "GPRINT:var1:LAST:\"%2.0lf%%\" ";
37+
$def[1] .= "GPRINT:var1:AVERAGE:\"(Avg\: %2.0lf%%,\" ";
38+
$def[1] .= "GPRINT:var1:MIN:\"Min\: %2.0lf%%,\" ";
39+
$def[1] .= "GPRINT:var1:MAX:\"Max\: %2.0lf%%)\" ";
40+
$def[1] .= "HRULE:$CRIT[1]#FFFF00 ";
41+
$def[1] .= "HRULE:$WARN[1]#FF0000 ";
42+
$def[1] .= "HRULE:$MIN[1]#FFFF00 ";
43+
$def[1] .= "HRULE:$MAX[1]#FF0000 ";
44+
?>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
# +------------------------------------------------------------------+
3+
# | ____ _ _ __ __ _ __ |
4+
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
5+
# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
6+
# | | |___| | | | __/ (__| < | | | | . \ |
7+
# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
8+
# | |
9+
# | Copyright Mathias Kettner 2010 [email protected] |
10+
# +------------------------------------------------------------------+
11+
#
12+
# This file is part of Check_MK.
13+
# The official homepage is at http://mathias-kettner.de/check_mk.
14+
#
15+
# check_mk is free software; you can redistribute it and/or modify it
16+
# under the terms of the GNU General Public License as published by
17+
# the Free Software Foundation in version 2. check_mk is distributed
18+
# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
19+
# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
20+
# PARTICULAR PURPOSE. See the GNU General Public License for more de-
21+
# ails. You should have received a copy of the GNU General Public
22+
# License along with GNU Make; see the file COPYING. If not, write
23+
# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
24+
# Boston, MA 02110-1301 USA.
25+
26+
# +------------------------------------------------------------------+
27+
# | This file has been contributed by: |
28+
# | |
29+
# | Michael Nieporte <[email protected]> |
30+
# +------------------------------------------------------------------+
31+
32+
$opt[1] = "--vertical-label \"Value (C)\" -l 0 -u 45 --title \"$servicedesc\" ";
33+
34+
$def[1] = "DEF:var1=$RRDFILE[1]:$DS[1]:MAX ";
35+
$def[1] .= "AREA:var1#2080ff:\"Temperature\:\" ";
36+
$def[1] .= "GPRINT:var1:LAST:\"%2.0lfC\" ";
37+
$def[1] .= "LINE1:var1#000080:\"\" ";
38+
$def[1] .= "GPRINT:var1:MAX:\"(Max\: %2.0lfC,\" ";
39+
$def[1] .= "GPRINT:var1:AVERAGE:\"Avg\: %2.0lfC)\" ";
40+
$def[1] .= "HRULE:$WARN[1]#FFFF00:\"Warning\: $WARN[1]C\" ";
41+
$def[1] .= "HRULE:$CRIT[1]#FF0000:\"Critical\: $CRIT[1]C\" ";
42+
?>

0 commit comments

Comments
 (0)