PIKT comments are in the C++ style.
The // double-slash character sequence, which can appear anywhere in a line, comments out the remainder of the line.
// comments are useful in a wide variety of situations.
For example, to demarcate a configuration section:
/////////////////////////////////////////////////////////////////////////////// // linux hostgroups linux members gentoo redhat suse ///////////////////////////////////////////////////////////////////////////////As another example, to comment script code:
rule // log anything not bypassed =output_alarm_log($inlin)And another example, to suppress something (here, in a macro definition):
sysadmins =berto =steve =mary // =charley // charley is on vacationAnd still another example, to bypass a PIKT #include file:
//#include <macros/files_pikt_log_macros.cfg>The /* <text> */ sequence comments out everything between the opening /* and closing */.
For example, to comment out more than one configuration line:
/* rule // page if the system is down if #down =page("$system is down!", =sysadmins) endif */Or to comment out an entire configuration section:
/* #if piktmaster Admin // for scripts aiding in the administration of the PIKT system timing 45 2 * * * // 1 //timing 45 4 * * * 5 mailcmd "=mailx -a 'From: piktadmin' -s 'PIKT Alert on =pikthostname: Admin' =pikt-admin" scripts [...] #endif // piktmaster *//* */ comments may not be nested. , That is, don't do something like this
/* rule // for missioncritical systems, if state was "-", is now "+", // then report change if $state ne %state /* && " $missioncritical " =~ " $host " */ output mail "$host's (S) services are back up" fi */since the */ at the end of the line
if $state ne %state /* && " $missioncritical " =~ " $host " */will close the comment begun just before the 'rule' statement, and the second */ (at the end of the example) will be left hanging, resulting in a syntax error.
Unless inside a /* */ comment, /* and */ after a // on the same line are ignored.
input proc "for f in =logdir\/\*.log; do =echo -n '$f '; =tail -n 1 $f; done"or as in this macro definition
piktdocroot http:\/\/pikt.org/piktFor purposes of suppressing commenting, you can also use the #fix ... #unfix preprocessor directives, as in
#fix piktdocroot http://pikt.org/pikt #unfixYou might also try using the #verbatim preprocessor directive for this purpose.
Comments are especially useful for debugging syntax errors in your PIKT configuration. Try using // and/or /* */ comments to nullify lines or entire sections of the configuration. If your problem goes away, the fault is in the commented-out line(s) or section(s). Be sure not to nest /* */ comments when debugging configuration syntax errors in this fashion.
For many more comment examples, see Samples.
|prev page||1st page||next page|