[Check_mk (english)] check_mk OMD pnp4nagios local check templates

Hi

According to
http://mathias-kettner.de/checkmk_localchecks.html :

···

PNP Templates for lal checks

Note for OMD users: The setup will work out of the box as described below. If you want to have custom graph templates, read on.

PNP4Nagios uses the name of the check command for selecting a template for rendering the RRD graph. Since all local checks have the same command check_mk-local ,
the template check_mk-local.php will be used for all cases.

Since version 1.0.37, Check_mk ships a wrapper template with that name, that tries to find a service specific template file matching a prefix of the service description. Let’s assume the service
description is LDAP auth/4. The wrapper then first tries to find the file LDAP
auth_4.php (slashes are replaced with underscores). If that file is present, it is used as template. Otherwise the file LDAP
auth_.php will be tried, then LDAP auth.php, LDAP
aut.php and so on until L.php . If none of
those files is present, then PNP4Nagios’ default.php will be loaded and will generate a graph based on your warn/crit
levels.

All those files are expected to be in the same directory as check_mk-local.php.

I am having trouble making this work.

My site version is 0.57.x:

[root@LVMON03 ~/]# ll /opt/omd/sites/omdlv/

lrwxrwxrwx 1 omdlv omdlv 13 Aug 23 15:48 share -> version/share

lrwxrwxrwx 1 omdlv omdlv 28 Oct 22 12:30 version -> …/…/versions/0.57.20121019

My check_mk-local.php is in /opt/omd/versions/0.57.20121019/share/check_mk/pnp-templates/:

[root@LVMON03 pnp-templates]# locate check_mk-local.php

/opt/omd/versions/0.57.20121019/share/check_mk/pnp-templates/check_mk-local.php

My check’s Service desc is “Check_FBB_Active_Sessions_Age” (have tried with and without spaces)

[root@LVMON03 pnp-templates]# tail -n20 /opt/omd/sites/omdlv/var/pnp4nagios/perfdata/LVARADIALDB/Check_FBB_Active_Sessions_Age.xml

<NAGIOS_SERVICEDESC>Check_FBB_Active_Sessions_Age</NAGIOS_SERVICEDESC>

But still the Default template is used. What have I missed?

Colin Taylor

Production Network Engineer

Globe Wireless UK

186 Century Building Tower Street
Brunswick Business Park Liverpool L3 4BJ UK

Registered in England No 02380744

Tel: +44 151 709 2217 Ext 1119

colin.taylor@globewireless.com

www.globewireless.com

Figured it out.

I wasn’t using a local check – I was using a “Classical active and passive Nagios check” configured in WATO.

I gave the check an “Internal command name” (my_command_name) and named the template file (my_command_name.php) – and it sprang into life.

···

//Colin

From: checkmk-en-bounces@lists.mathias-kettner.de
[mailto:checkmk-en-bounces@lists.mathias-kettner.de] On Behalf Of Colin Taylor
Sent: 24 October 2012 16:09
To: checkmk-en@lists.mathias-kettner.de
Subject: [Check_mk (english)] check_mk OMD pnp4nagios local check templates

Hi

According to
http://mathias-kettner.de/checkmk_localchecks.html :

PNP Templates for lal checks

Note for OMD users: The setup will work out of the box as described below. If you want to have custom graph templates, read on.

PNP4Nagios uses the name of the check command for selecting a template for rendering the RRD graph. Since all local checks have the same command check_mk-local ,
the template check_mk-local.php will be used for all cases.

Since version 1.0.37, Check_mk ships a wrapper template with that name, that tries to find a service specific template file matching a prefix of the service description. Let’s assume the service
description is LDAP auth/4. The wrapper then first tries to find the file LDAP
auth_4.php (slashes are replaced with underscores). If that file is present, it is used as template. Otherwise the file LDAP
auth_.php will be tried, then LDAP auth.php, LDAP
aut.php and so on until L.php . If none of
those files is present, then PNP4Nagios’ default.php will be loaded and will generate a graph based on your warn/crit
levels.

All those files are expected to be in the same directory as check_mk-local.php.

I am having trouble making this work.

My site version is 0.57.x:

[root@LVMON03 ~/]# ll /opt/omd/sites/omdlv/

lrwxrwxrwx 1 omdlv omdlv 13 Aug 23 15:48 share -> version/share

lrwxrwxrwx 1 omdlv omdlv 28 Oct 22 12:30 version -> …/…/versions/0.57.20121019

My check_mk-local.php is in /opt/omd/versions/0.57.20121019/share/check_mk/pnp-templates/:

[root@LVMON03 pnp-templates]# locate check_mk-local.php

/opt/omd/versions/0.57.20121019/share/check_mk/pnp-templates/check_mk-local.php

My check’s Service desc is “Check_FBB_Active_Sessions_Age” (have tried with and without spaces)

[root@LVMON03 pnp-templates]# tail -n20 /opt/omd/sites/omdlv/var/pnp4nagios/perfdata/LVARADIALDB/Check_FBB_Active_Sessions_Age.xml

<NAGIOS_SERVICEDESC>Check_FBB_Active_Sessions_Age</NAGIOS_SERVICEDESC>

But still the Default template is used. What have I missed?

Colin Taylor

Production Network Engineer

Globe Wireless UK

186 Century Building Tower Street
Brunswick Business Park Liverpool L3 4BJ UK

Registered in England No 02380744

Tel: +44 151 709 2217 Ext 1119

colin.taylor@globewireless.com

www.globewireless.com