Monitor Windows Clients ( DISK CPU and others)

Hello Amazing Community
I have problem while adding windows Host to Icinga
in my Windows Machine , i have open the port 5665 IN and OUT in my LOCAL FIREWALL
second , i have installed the agent , add the signed ticket ( see the capture)




after that , i restarted the service of icinga in windows machine,
in my master node ( which is centos 7 machine)
i have added the configuration file for this machine under /etc/icinga2/zone.d/master.myfile.conf

object Endpoint "WPPSE0006.com" {
}
object Zone "WPPSE0006.com" {
     endpoints = [ "WPPSE0006.com" ]
     parent = "master"
}
object Host "WPPSE0006.com" {
   vars.client_endpoint = name
    import "generic-host"
    check_command = "hostalive"
    address = "x.x.x.x"
    display_name = "PREPROD 0"
    vars.os = "Windows"
vars.notification["mail"] = {
    groups = [ "icingaadmins" ]
    users = ["icingaadmin"]
  }
enable_notifications = true
vars.notification_type = "email"
}
vars.disks_windows["disk C:"] = {
    disk_win_path = "C:"
  }

the disk check for windows under service.conf who is the same position as hosts.conf in /etc/icinga2/zoned.d/master

apply Service for (disk => config in host.vars.disks_windows)  {
  import "generic-service"
  check_command = "disk-windows"
  command_endpoint = host.vars.client_endpoint
  assign where host.vars.agent_endpoint
  vars += config
assign where host.vars.os == "Windows"
}

But i can only view the hostalive check and no disk
I watched many videos on youtube , they just add the windows hostname in the right config file and all the services will be up automaticaly but nothing happend for me
Any advices and what should i do ?
thank you all
Cordially

Any News guys ?
I tried with the same as monitoring disk like centos but for windows-disk
i get the value of partition in linux and not C:/ or D:/
Whaat should i do ?

I have edited your post for better readability of the config snippets.

Please use the code formatting (backticks ```) in the future, so that it is easier for people to read :slight_smile:
You find a overview of the editor options here:

back to topic :slight_smile:
not sure if two single assign statements work, so put them in one:
assign where host.vars.os == "Windows" && host.vars.agent_endpoint

1 Like

Okay , Im new in this community and i dont know all what should i do, thanks for the references
But for my issue i edited that and its not working and what i get is the partition of Linux and not the C:/ or other partitions

There is no new about this topic ?

You need to define zone and endpoint objects in zones.conf only if you are using V2.11. Apply For do not need any assign rules.

1 Like

Always a good idea, as its hard to see if the brackets are at the right position :slight_smile:

object Host "WPPSE0006.com" {
    import "generic-host"
    check_command = "hostalive"
    address = "x.x.x.x"
    display_name = "PREPROD 0"
    enable_notifications = true 
    vars.client_endpoint = name
    vars.os = "Windows"
    vars.notification_type = "email"
    vars.notification["mail"] = {
        groups = [ "icingaadmins" ]
        users = ["icingaadmin"]
    }
    vars.disks_windows["disk C:"] = {
        disk_win_path = "C:"
    }
}

Try this, cleaned up code. Also, i moved vars.client_endpoint down. So, if your “generic-host” also defines it, it will not get overwritten by “generic-host”

1 Like

Hello , Thanks a lot for replying , and i’m sorry for bein late, but he is always showing me the result based on linux system and not for windows

Have you corrected your host like i said?

Also giving the check a better name would be a good idea to make clear, where a check is coming from (at least for debugging):

apply Service "Windows-Disk-" for (disk => config in host.vars.disks_windows)  {

Hello ,
yes i did and the result are here :


The status is always Pendind

Hello Again , I tried to modify the zone.conf file and i added just the name of the host without FQDN and the result is in the capture
image
i see here that the value is inversed like the disk F:/ is all free and the warning setting and the critical are inversed
Thanks all for your help , ill try to make the maximum and i’ll go back to you when i resolve the problem

Hello again ,
i have found the solution for this issue,
first, the name of the node client should be the same in the zone.conf file
second , i have add the line to get the right result in the client machine

    vars.disk_win_show_used = "true"

if you want the configuration in service.conf :

apply Service “Windows Disk” {
command_endpoint = host_name
check_command = “disk-windows”
vars.disk_win_show_used = “true”
vars.disk_win_warn = “80%”
vars.disk_win_crit = “90%”
assign where host.vars.os == “Windows”
}

Finnaly , i would like to thanks this great community :slight_smile:
Thank you and the problem is resolved
Best Regards
Mouhssine.

2 Likes