Windows http check monitoring

I have noticed check_http on templates & it is not working for windows… What is the best practice to do the http_checks in windows systems? Can you someone advise the plugins we have for windows http check?

the http check is typically run remotely. do you have a master/satellite running Windows instead of *nix? That template is for the standard Linux based Nagios check_http.

2 Likes

We are not using the Master/Satellite configuration… We have one Linux master & Monitoring all windows servers…

I have been following the documentation for http windows monitoring. https://www.claudiokuenzler.com/blog/685/simple-http-check-monitoring-plugin-windows-check_http-alternative
i have made the check_http.vbs script tested on remote server & looks good…
image

But the question is how come this result status brought into icinga2 web…

What is the exact process to use the NSclient++ scripts to work on icinga2 master? Can you please advise on this?

I’m not sure why you’re doing it this way. Is there a reason the Windows servers need to be running the http checks and not the Icinga master? Typically the master uses check_http to check for open web services on the clients.

NSClient++ isn’t actually needed to execute such things; the commands can be defined in Icinga and the Icinga agent can run them itself. In this particular use case though, that might be doing things the hard way unless these servers need to be checking http on localhost for some reason.

Set aside, why should the Windows agent execute http checks? That’s the task of a satellite or master up front.

Since we only support basic agents on Windows, and no satellite instances, the icinga2 provided plugin binaries don’t include check_http, in contrast to what the monitoring plugins project provides on Linux/Unix.

Cheers,
Michael

I completely agree that icinga2 master should run the checks. I have beeen followiing this documentation to run the http checks from master with the script check_http.vbs…
[/settings/external scripts]
allow arguments=true

; TODO
[/settings/external scripts/scripts]

google_http_check=scripts\check_http.vbs

following exact documentation…

but unfortunately its not working… getting the below error after adding the metric

Command “C:\Program Files\ICINGA2/sbin/check_nrpe” -H 172.25.29.139 -c google_http_check failed to execute: 2, “The system cannot find the file specified.”

Any change i can get advise on this?

Sounds weird what you are trying. An icinga master cannot be a Windows machine and you try to run a vbs script to run on Linux?

Please take a look at this check command and create a service accordingly.

Please explain where the Icinga master is running on, the output of icinga2 --version is sufficient.

Apologies…I need to reframe the question…

We are running the Linux Icinga2 master & all remote machines are windows. we don’t have master/satellite configuration. We are just using the 1 master(linux) & Client(windows machines). Installed Icinga2 agent & NRPE bundled NSClient++ on remote windows machines…

there are few http end points on windows instances. I have been trying to do the http checks throught icinga2… Can you please advise on this?

Thanks for your response… Here, the output

icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.3-1)

Copyright © 2012-2019 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl2.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
Platform: Ubuntu
Platform version: 19.04 (Disco Dingo)
Kernel: Linux
Kernel version: 5.0.0-16-generic
Architecture: x86_64

Build information:
Compiler: GNU 8.3.0
Build host: lgw01-amd64-039

Application information:

General paths:
Config directory: /etc/icinga2
Data directory: /var/lib/icinga2
Log directory: /var/log/icinga2
Cache directory: /var/cache/icinga2
Spool directory: /var/spool/icinga2
Run directory: /run/icinga2

Old paths (deprecated):
Installation root: /usr
Sysconf directory: /etc
Run directory (base): /run
Local state directory: /var

Internal paths:
Package data directory: /usr/share/icinga2
State path: /var/lib/icinga2/icinga2.state
Modified attributes path: /var/lib/icinga2/modified-attributes.conf
Objects path: /var/cache/icinga2/icinga2.debug
Vars path: /var/cache/icinga2/icinga2.vars
PID path: /run/icinga2/icinga2.pid
strong text

Then put the http checks into the master zone, and let them execute from over there with the http CheckCommand.

I have seen http checkcommand on command-plugins.conf under itl templates… But this is only working for remote linux machines & not working for remote windows machines… is this build for linux?

The monitoring plugins templates described in the ITL target Unix/Linux where they are available. The underlaying binary check_http can only be compiled on Linux/Unix and several distributions also provide packages for the monitoring plugins suite. That’s described in the chapter when you install Icinga 2 for the first time.

Thanks Michael…

Here, Service config block:

apply Service for (http_vhost => config in host.vars.http_vhosts) {
import “generic-service”
display_name = "HTTP: " + http_vhost
check_command = “http”
command_endpoint = host.vars.client_endpoint
assign where host.vars.client_endpoint
notes = http_vhost
vars += config
vars.http_vhost = http_vhost
vars.http_ssl = true
vars.http_sni = true
vars.http_port = “8080”
vars.http_method = “CONNECT”
vars.http_warn_time = “5”
vars.http_critical_time = “10”
}

Host config file is as shown below.

object Host “*********************” {
check_command = “hostalive”
address = “172.25.30.25”
vars.os=“AWS-Windows”
// Custom Optional check - START
vars.local_disks["/app Filesystem"] = {
disk_partitions = “/app”
}

vars.local_http_vhosts["http.com"] = {
   http_uri = "http://*************"
   http_string = "A string that appears in the home page"
   http_ssl = true
   http_sni = true
   http_ssl_force_tlsv1_or_higher = "1"
   http_certificate = "8,4"

}

This is not working… Not shown anything in Icinga2 web… Anything i am missing?

Take out the command_endpoint line. That’s telling it to check from the client node. Without that set, it will be the master making sure it can access http against the client, rather than the client trying to check itself.

Yes you are right… Apologies for asking multiple times on the same thing. Somehow for http check, I am always getting critical.

I have been following this page to add http check

https://sites.google.com/site/salinuxacademy/monitoring/icinga-2/http-checks-by-icinga2.

If you get a chance can you please send me the example host config & service config that i need to update for http check? Apologies again

The default services.conf and hosts.conf that Icinga ships with give some good examples on this. You can read through them here if you’ve removed those:

This has been mentioned regarding the available variables for that check:
https://icinga.com/docs/icinga2/latest/doc/10-icinga-template-library/#http

Here’s a quick example I wrote just defining the service without looping over it like in the default config. This goes off your Google example:

object Host "www.google.com" {
  check_command = "hostalive"
  address = "172.217.12.206"
}

apply Service "I'm Feeling Lucky" {
  import "generic-service"
  check_command = "http"

  vars += {
    http_ssl = true
    http_vhost = "www.google.com"
    http_string = "I'm Feeling Lucky"
  }

  assign where host.name == "www.google.com"
}
1 Like

Thanks for your response Blake… You are right… This looks good… But unfortunately we have applications with multiple paths like 172.217.12.206/pathA & 172.217.12.206/pathB with different ports at that time how i can do the http checks? I have been tried number of ways But doesn’t work… Getting socket connect failed errors. I am not very knowledgable on this. This is the only metric that i have been struggling completely… Can you please help on this?

Hi,

take a look into the default config for examples:
https://github.com/Icinga/icinga2/blob/master/etc/icinga2/conf.d/hosts.conf#L18 and
https://github.com/Icinga/icinga2/blob/master/etc/icinga2/conf.d/services.conf#L57

so a simple setup:

object Host "some-host" {
    import "generic-host"

    address = "172.217.12.206"

    vars.http_vhosts["http-pathA"] = {
        http_uri = "/pathA"
        http_port = 1337
        http_ssl = true
        # .....
        # check the docs for all parameters
    }
    vars.http_vhosts["http-pathB"] = {
        http_uri = "/pathB"
        http_port = 7331
        # .....
        # check the docs for all parameters
    }
}

apply Service for (http_vhost => config in host.vars.http_vhosts) {
    import "generic-service"

    check_command = "http"
    vars += config

    assign where host.name == "some-host"
}

For available parameters in your vhost config object take a look into the docs.
http-pathA and http-pathB are just examples, can be any name you want.

Greetz

1 Like