Hi,
> On 12 Aug 2016, at 02:32, Michael Martinez <[email protected]> wrote:
>
> Coming back to this after taking a while working on other stuff.
>
> I'm running into an issue. The issue is that get_host().state is
> returning "1" for every host, including those that are UP. See below
> for the config I am working with. Just for testing I am using my
> "vagrant-minion" box which is running Icinga2. It's UP and has been UP
> for a long time, but vars.cluster_data contains "1".
>
> It seems the get_host() is not returning the correct host state. Any thoughts?
>
>
> object CheckCommand "check_cluster" {
> import "plugin-check-command"
> command = [
> PluginDir + "/check_cluster",
> "-h", "",
> "-l", "$cluster_label$",
> "-w", "$cluster_warning$",
> "-c", "$cluster_critical$",
> "-d", "$cluster_data$",
> ]
> vars.cluster_warning = "0"
> vars.cluster_critical = "1"
> }
>
> apply Service "clusterX" {
> import "generic-service"
> check_command = "check_cluster"
>
> vars.cluster_label = get_host("vagrant-minion").state
> vars.cluster_data = get_host("vagrant-minion").state
That as such won’t work since the custom attributes values are computed at
config compile time. You are looking for runtime calculated values - which is
why you need to turn the custom attribute values into a function.
Something like that:
vars.cluster_label = {{ get_host("vagrant-minion").state }}
vars.cluster_data = {{ get_host("vagrant-minion").state }}
http://docs.icinga.org/icinga2/latest/doc/module/icinga2/toc#!/icinga2/latest/doc/module/icinga2/chapter/monitoring-basics#custom-attributes-functions
Kind regards,
Michael
>
> assign where host.name == "x ['us-east-1a', 'us-east-1d', 'us-east-1e']"
> }
> _______________________________________________
> icinga-users mailing list
> [email protected]
> https://lists.icinga.org/mailman/listinfo/icinga-users
--
Michael Friedrich, DI (FH)
Senior Developer
NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
CEO: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | [email protected]
** OSBConf 2016 - September - osbconf.org **
** OSMC 2016 - November - netways.de/osmc **
_______________________________________________
icinga-users mailing list
[email protected]
https://lists.icinga.org/mailman/listinfo/icinga-users