Closed spuder closed 9 years ago
Consul has to be installed on every node and you have to install consul servers as well, but this plugin only needs to be installed on your nagios instance.
Of course you can use chef to install consul to your cluster, we use our own cookbooks, but there is a community cookbook as well: https://github.com/johnbellone/consul-cookbook
If you have a working consul setup and the plugin installed on a nagios instance you can add some nagios commands like these:
define command {
command_name check-serf-health
command_line /opt/nagios-plugins/consul/check-consul-health.py node $ARG1$ $ARG2$ --CheckID=serfHealth 2>&1
}
define command {
command_name check-service-health
command_line /opt/nagios-plugins/consul/check-consul-health.py node $ARG1$ $ARG2$ --ServiceName=$ARG3$ 2>&1
}
Using these commands you can add consul check based host and service definitions with consul-template:
{{range service "myservice@<%= dc %>" "any"}}
define host {
use generic-host
host_name {{.Node}}
alias {{.Node}}
address {{.Address}}
check_command check-serf-health!{{.Node}}!<%= dc %>
}
define service {
use generic-service
host_name {{.Node}}
service_description {{.Name | toUpper}}_CONSUL_HEALTH
check_command check-service-health!{{.Node}}!<%= dc %>!{{.Name}}
}
{{end}}{{end}}
Thanks for the information. I don't have a nagios server, but I like the idea of using the nagios syntax for error checking. It sounds like that isn't the intended use case of this plugin.
This plugin is intended to be used with nagios primarily. I can't think of any other good use cases, but maybe you have something on your mind.
This plugin looks great.
How do you install this?