Differences

This shows you the differences between two versions of the page.

pnp-0.6:tpl_custom [2012/08/08 21:52]
calestyo changes according to pull request #46
pnp-0.6:tpl_custom [2012/08/08 22:26] (current)
calestyo
Line 40: Line 40:
This option has effect only during creation of the RRD database. This option has effect only during creation of the RRD database.
 +
===== DATATYPE ===== ===== DATATYPE =====
Line 96: Line 97:
This option has effect only during creation of the RRD database. This option has effect only during creation of the RRD database.
 +
 +===== Hints on Template Names =====
 +
 +In most situations, one can easily get desired template names, by using suitable command object definitions.
 +
 +Consider the followng example:
 +<code>
 +define command {
 +  command_name check_by_ssh
 +  command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$
 +}
 +</code>
 +with commands like:
 +<code>
 +  …
 +  check_command check_by_ssh!/usr/lib/nagios/plugins/check_load -w 4,4,4 -c 5,5,5
 +  …
 +</code>
 +
 +Even when using “CUSTOM_TEMPLATE = 1” one would end up in template names like “_usr_lib_nagios_plugins_check_load_-w_4,4,4_-c_5,5,5”, which is highly undesired, especially because of the parameters in it.
 +
 +**Solution 1: Split parameters into separate $ARGn$**
 +
 +A simple solution is to use the following command object definition:
 +<code>
 +define command {
 +  command_name check_by_ssh
 +  command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$ $ARG2$
 +}
 +</code>
 +with commands like:
 +<code>
 +  …
 +  check_command check_by_ssh!/usr/lib/nagios/plugins/check_load!-w 4,4,4 -c 5,5,5
 +  …
 +</code>
 +(notice the additional “!”)
 +
 +This even works, when $ARG2$ is let empty.
 +
 +Of course one would still need to set “CUSTOM_TEMPLATE = 1”.
 +
 +
 +**Solution 2: Hide the remote executor inside the command object definition**
 +
 +Another way is to “hide” the remote excutor in the respective command object definitions.
 +
 +Instead of defining:
 +<code>
 +define command {
 +  command_name check_by_ssh
 +  command_line /usr/bin/ssh $HOSTADDRESS$ $ARG1$ $ARG2$
 +}
 +</code>
 +one would define the following for **every** command to be remotely executed:
 +<code>
 +define command {
 +  command_name check_load_by_ssh
 +  command_line /usr/bin/ssh $HOSTADDRESS$ /usr/lib/nagios/plugins/check_load $ARG1$
 +}
 +</code>
 +with commands like:
 +<code>
 +  …
 +  check_load_by_ssh!-w 4,4,4 -c 5,5,5
 +  …
 +</code>
 +Of course one must not set “CUSTOM_TEMPLATE = 1” in this way.
 +
 +
 +Which of above two solutions one follows is largely a matter of taste.
 +
 +
[[start|back to contents]] | [[advanced|PNP in distributed environments]] [[start|back to contents]] | [[advanced|PNP in distributed environments]]
pnp-0.6/tpl_custom.1344455531.txt.gz · Last modified: 2012/08/08 21:52 by calestyo
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0