More than one command defined

Andreas Ericsson ae at op5.se
Thu Nov 18 18:09:44 CET 2010


On 11/18/2010 05:25 PM, Deborah Martin wrote:
> Hi,
> 
> I have a need to run two different commands when processing the performance
> data from Nagios (3.2.2)
> 
> I want the first  command to run the process-perfdata.pl script from
> pnp4nagios and the second command to log various things to a different log
> file.
> 
> The reason is that we've only just had a requirement to process performance
> data for pnp4nagios graphing. But historically we've created our own
> "performance data" log
> which is then used within a database to produce SLA reports developed
> in-house (no graphing just numbers produced for the SLA reports)
> 
> If I do the following I don't get an errors when I run nagios -v nagios.cfg
> ... :-
> 
> define command {
>          command_name process-service-perfdata-file
>          command_line<first command>  - process performance data for
> pnp4nagios
>          command_line<second command>  - log different data to a different
> file
>          }
> 

I'm not surprised. This is a sort of unintentional fallout that comes from
using the template system the way it's defined today. I guess only the
second command_line will get run though, right?

> I'd like to avoid creating a script with both commands in if I can help it
> as it's extremely useful to keep it simple and visible in the
> misccommands.cfg file.
> 
> Perhaps there is some other way I can do this or is a script with both
> commands really the only way ?
> 

You could use Merlin and set the perfdata_table option in the database
section of the daemon compound. Then you can grab the perfdata items
from the merlin database. Note that you'll have to drop old entries
from that table every once in a while though, as the table will surely
grow huge otherwise.

That doesn't really let you have things visible in the misccommands.cfg
file though, so you'll have to pick your poison on this one.

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. 
::: Messages without supporting info will risk being sent to /dev/null





More information about the Users mailing list