opinkerfi / adagios

Adagios - Web Based Nagios Configuration
GNU Affero General Public License v3.0
329 stars 75 forks source link

Configure > Service > Add Service > Monitoring #135

Closed zugolosian closed 11 years ago

zugolosian commented 11 years ago

Hi,

Would it be possible to have a drop down of check commands?

Also when a check command is added would it be possible to have the macros available for that check show up when the check is saved? they show up when you go through the okconfig menu.

Or am I just doing it wrong? If I add a service and a check command in it requires arguments to function where do I put them,, or is the expectation that people will always use service templates or use geek edit?

tomas-edwardsson commented 11 years ago

One thing at a time! ;-)

Drop down for check_commands, I will investigate, I think we should use a more convenient manner to choose them.

I don't understand exactly what you are going for here, a service check or adding a check_command? Macros are something that are defined and passed onto the check_command. There is no good way today to ask the plugin which macros it should support or stuff like that.

I suggest you check out the /usr/share/okconfig/examples and /usr/share/okconfig/templates to see if you are really looking for creating your own okconfig service template, if that is indeed what you want to do, you can drop them into /etc/nagios/okconfig/examples and /etc/nagios/okconfig/templates and they will be usable through okconfig once that is done.

zugolosian commented 11 years ago

Understood.

Just getting my head around the differences between a service template and creating a service without using a template.

Like if I add a service (without a template) and the command run in that service requires arguments it's not a trivial task to input the arguments. One has to go to the command, take a look at what variables are being looked for and input them as macros. I still can't figure out how to pass standard ARG1 and ARG2 etc through the web interface.

tomas-edwardsson commented 11 years ago

Below I try to layout the differences between 3 different methods, hope this makes it clearer.

Standard arguments

Standard args are passed through something like the following, note that arguments in the service check_command are delimited by a exclamation (!)

define command{
    command_name        my_check_http
    command_line        $USER1$/check_http -I $HOSTADDRESS$ -H $ARG1$
}

define service {
    service_description HTTP
    use                 generic-service
    name                my-http-service
    check_command       my_check_http!<this is ARG1, something like www.example.com>
    register            0
}

Service Macros

If you would like to make a clever macro based http service you would do something like the following

define command{
    command_name        my_check_http
    command_line        $USER1$/check_http -I $HOSTADDRESS$ -H $_SERVICE_VIRTUAL_HOST$
}

define service {
    service_description HTTP www.example.com
    use                 generic-service
    name                my-http-service
    check_command       my_check_http
    register            0

    __VIRTUAL_HOST  www.example.com
}

OKConfig Style Template

Note that the HOSTNAME and GROUP are replaced with the relevant values when you use okconfig.

/usr/share/okconfig/examples/http.cfg-example

define service {
    host_name           HOSTNAME
    contact_groups      GROUP
    service_description HTTP HOSTNAME
    check_command       okc-check_http
    use                 generic-service

    __URI               /
    __SEARCH_STRING
    __RESPONSE_WARNING  2
    __RESPONSE_CRITICAL 10
    __VIRTUAL_HOST      HOSTNAME
    __PORT              80

}

/usr/share/okconfig/templates/http/commands.cfg

define command {
    command_name        okc-check_http
    command_line        $USER1$/check_http -I $HOSTADDRESS$ -H "$_SERVICE_VIRTUAL_HOST$" -p "$_SERVICE_PORT$" -u "$_SERVICE_URI$" -s "$_SERVICE_SEARCH_STRING$" -w "$_SERVICE_RESPONSE_WARNING$" -c "$_SERVICE_RESPONSE_CRITICAL$"
}

Hope this makes things a little clearer.

zugolosian commented 11 years ago

It does, thanks!

You should totally throw this in the wiki.

palli commented 11 years ago

check_command is now a drop down

zugolosian commented 11 years ago

You guys a pretty rock and roll.

garcia88jose commented 9 years ago

Hi,

Sorry bother you, because its been a long time since this post came out.

I am new to okconfig, but I'm using naemon, a fork of nagios 4.0

I am using Naemon with Adagios and okconfig, but somehow my own template files are not loaded. I put them on /etc/naemon/okconfig/examples/

Is it necessary to put an cfg_dir entry on my naemon.cfg file or something else? Thanks in advance.

palli commented 9 years ago

Hmm, the relevant config file should be /etc/okconfig.conf .. Can you post the contents of that file ?