Hello everybody,
my questions are as follows:
you can access from a Perl program to the state of hosts and services on Nagios? Where can I find information about the controls or libraries that make it possible to obtain information about Nagios hosts and services?
thank you
Tarzan
Getting information from Nagios
Re: Getting information from Nagios
I don't know of any Perl libraries for assessing the Nagios Core system state, but the status.dat file defined in your nagios.cfg file under the status_file directive is a good place to start. Take a look through that file and see if it's got the sort of information you're looking to access.
Monitoring::Plugin is a pretty popular library for creating Nagios Core plugins though:
http://search.cpan.org/~nierlein/Monito ... /Plugin.pm
Monitoring::Plugin is a pretty popular library for creating Nagios Core plugins though:
http://search.cpan.org/~nierlein/Monito ... /Plugin.pm
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Getting information from Nagios
Thanks, I'll try and let you know.
Re: Getting information from Nagios
Sure! Let us know if you encounter additional issues.
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/
Re: Getting information from Nagios
Hello,
you can by a Perl program using macros on demand Nagios?
Thank you
you can by a Perl program using macros on demand Nagios?
Thank you
Re: Getting information from Nagios
I assume you're talking about these?
https://assets.nagios.com/downloads/nag ... olist.html
The Nagios macros are evaluated when Nagios Core executes a given command. So if you wrote a Perl script that accepts certain arguments (a path, file, warning/critical thresholds, service name, etc), you could feel the Nagios Core macros into that script via the Nagios Core command definition.
Here's an example of a command definition calling check_disk locally with 3 arguments:
What macros you have access to for a given situation depends. You can reference that document I linked above for which macros are available in which contexts.
https://assets.nagios.com/downloads/nag ... olist.html
The Nagios macros are evaluated when Nagios Core executes a given command. So if you wrote a Perl script that accepts certain arguments (a path, file, warning/critical thresholds, service name, etc), you could feel the Nagios Core macros into that script via the Nagios Core command definition.
Here's an example of a command definition calling check_disk locally with 3 arguments:
Code: Select all
define command {
command_name check_local_disk
command_line $USER1$/check_disk.pl -w $ARG1$ -c $ARG2$ -p $ARG3$
}
Former Nagios employee
https://www.mcapra.com/
https://www.mcapra.com/