Page 1 of 1

Define plugins - help

Posted: Tue May 12, 2015 6:37 am
by warhansen
Hi,

I have a nagios setup which is monitoring windows and Linux machines. What I don't quite understand is how to define a plugin. My Nagios is running on Ubunutu.I have setup the check_smtp plugin and it works, but I need to know how to define it more specifically.

What I do understand:

All plugins are in /usr/lib/nagios/plugins and /usr/local/nagios/libexec
you can test a plugin by running commands in that directory for example: check_smtp -H 10.0.0.189 -p 25
You setup you objects (hosts) in /usr/local/nagios/etc/objects. I have a .cfg for each host and once setup I add it in //usr/local/nagios/etc/nagios.cfg under the correct "definitions for monitoring a xxx machine"
check_smtp is defined in /usr/local/nagios/objects/commands.cfg: define command { command name...


What I don't understand

How do I define my check_smtp to go look on port 50. I know smtp doesnt run over port 50 but if I wanted to, how to I set it. Nowhere is there a check_smtp.cfg so nagios always assumes the defaults, but how do I define the switches for my nagios as in the help file:

Usage:
check_smtp -H host [-p port] [-4|-6] [-e expect] [-C command] [-R response] [-f from addr]
[-A authtype -U authuser -P authpass] [-w warn] [-c crit] [-t timeout] [-q]
[-F fqdn] [-S] [-D warn days cert expire[,crit days cert expire]] [-v]

In the commands is says: command line $user1$/check_smtp -H $HOSTADDRESS$ $ARG1$.

So where can I stipulate check_smtp $HOSTADDRESS$ -p50 -w3 -c5

Thank you.

Re: Define plugins - help

Posted: Tue May 12, 2015 7:52 am
by jdalrymple
That would be in your service definition.

This is the documentation you need: http://nagios.sourceforge.net/docs/nagi ... tions.html

You would create a service something like:

Code: Select all

define service {
        host_name                       mailhost
        service_description             SMTP
        use                             generic-service
        check_command                   check_smtp!-p 50
        register                        1
        }
The thing to note in that service definition is that $ARG1$, $ARG2$, etc are seperated by exclamation points (!) but it's not entirely necessary to specify more than 1 ARG - you can put all of your arguments (to be passed to the plguin) in 1 ARG1 (in the service definition).

Re: Define plugins - help

Posted: Tue Nov 22, 2016 5:09 am
by warhansen
Hi, This is a bit late but you can close this, I now understand the "waterfall" of Nagios.

Re: Define plugins - help

Posted: Tue Nov 22, 2016 10:24 am
by dwhitfield
Glad to hear it is resolved. I am going to lock the thread. Please feel free to post again if you have you another issue. Thank you for using the Nagios forums!