Page 1 of 2
How to put a plugin in use
Posted: Mon Feb 02, 2015 11:15 am
by ziedmahjoub
Hi,
i have installed Nagios Core 4.0.8 and plugins 2.0.3 !! and i want to add some plugins ! so i have downloaded one (check AVG) antivirus , a .php file , but after downloading it i didn't know what to do ,
and what i must modify to put it in use .
Can someone guid me , or give me a tutorial that can help me !!
thanks
Re: How to put a plugin in use
Posted: Mon Feb 02, 2015 11:23 am
by tmcdonald
You might want to take a look at a general Nagios tutorial, as this can be quite an in-depth topic:
http://tuxradar.com/content/nagios-made-easy
Re: How to put a plugin in use
Posted: Tue Feb 03, 2015 12:01 pm
by ziedmahjoub
I've seen it , but i didn't understand many things , its advanced for me i think , because i still new to nagios .
i just want to know if i download a plugin how can i intergrate it , in which config file ?
Re: How to put a plugin in use
Posted: Tue Feb 03, 2015 3:35 pm
by lmiltchev
I've seen it , but i didn't understand many things , its advanced for me i think , because i still new to nagios .
i just want to know if i download a plugin how can i intergrate it , in which config file ?
You will need to copy the plugin to your plugins directory and change the permissions if you need to. With most of the nagios plugins, you can run the "-h" or "--help" flag to view the usage, for example:
Code: Select all
/path/to/the/plugins/direcotry/<your plugin> -h
Test the plugin from the command line. After you make sure it works, you will need to create a command in the in commands.cfg file. Next, you will need to create a service definition. You can place it wherever you want (ususally in "/usr/local/nagios/etc/objects/" directory) as long as nagios can find it. Check your configuration with:
Code: Select all
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
Note: your paths may be different; adjust them accordingly.
You can find the Nagios Core documentation here:
http://nagios.sourceforge.net/docs/nagi ... n/toc.html
It can take a lot of work to get nagios configured, especially if you are new to it. If this is too difficult for you, try Nagios XI. It is a lot easier than Nagios Core. You can run monitoring wizards and the configs will be generated for you automatically.
http://www.nagios.com/
Hope this helps.
Re: How to put a plugin in use
Posted: Thu Feb 05, 2015 8:28 am
by ziedmahjoub
You will need to copy the plugin to your plugins directory and change the permissions if you need to. With most of the nagios plugins, you can run the "-h" or "--help" flag to view the usage, for example:
Code: Select all
/path/to/the/plugins/direcotry/<your plugin> -h
the path of the plugins directory can be this ? :
for the permissions i will give them full permission to avoid problems.
Re: How to put a plugin in use
Posted: Thu Feb 05, 2015 9:08 am
by scottwilkerson
ziedmahjoub wrote:
the path of the plugins directory can be this ? :
for the permissions i will give them full permission to avoid problems.
Yes, can you execute your plugin with the -h to see if there is instructions on how to run from the command line?
Code: Select all
/usr/local/nagios/libexec/<your plugin> -h
Re: How to put a plugin in use
Posted: Thu Feb 05, 2015 11:50 am
by ziedmahjoub
just a question :
there is some plugins that is written : compatible with nagios 3.x or nagios 2.x !!
meanwhile i have installed nagios core 4.0.8 , these plugins can work with nagios 4.x ?!!
Re: How to put a plugin in use
Posted: Thu Feb 05, 2015 12:05 pm
by abrist
ziedmahjoub wrote:there is some plugins that is written : compatible with nagios 3.x or nagios 2.x !!
meanwhile i have installed nagios core 4.0.8 , these plugins can work with nagios 4.x ?!!
Yes, the plugin format has not changed for quite some time. All of those should work with 4.x.x.
Re: How to put a plugin in use
Posted: Thu Feb 05, 2015 12:39 pm
by ziedmahjoub
ok thanks , for now i have added this plugin just to test if i can put new plugins and make them work .
i added this one :
http://exchange.nagios.org/directory/Pl ... ld/details (file .pl)
and i added this command in commands.cfg :
Code: Select all
define command{
command_name check_mysqld
command_line $USER1$/check_mysqld.pl -H $HOSTADDRESS$ -u $ARG1$ -p $ARG2$
}
and this service in windows.cfg :
Code: Select all
define service {
use generic-service
hostgroup_name mysql
service_description check SQL
check_command check_mysqld!foo!apples
}
and in the web interface i find a new service called
Check SQL , is that means that the plugin is successfully injected ?
Re: How to put a plugin in use
Posted: Thu Feb 05, 2015 12:43 pm
by tmcdonald
That looks about right!
Give it a few minutes to see if it is running properly and check the output/status info.