Windows Server Disk Size per Disk

Hello,

im trying to set up different thresholds for different disks on a windows machine.
Example:

C:\ < 10% = crit

D:\ <5% = crit

and so on.

The only way i can see, is to create a different check, for every disk, is this correct?
And im not sure, if there is an argument to do this for every Disk? I have tried -p but it seems not to work.
Im using the disk-windows check and director.

Thank you

Hi and welcome to our community,

you can create your own config in the service:

apply Service for (disk => config in host.vars.disks) {
	import "generic-service"
	check_command = "disks"

	vars += config
.
.
.
}

vars.disk [β€œdisk /”] = {
disk_partitions = β€œ/”
disk_wfree = β€œ10%”
disk_cfree = β€œ5%”
}
1 Like

Hi,

AFAIK you can not do this with Director. Director allows to create a β€œFOR” loop with the internal variable $config$, but you can only set one variable for the service check (i.e. partion/drive).

In your case you need to set multiple values per check (partition, warning, critical,…). Maybe it is possible to do this with DSL code which implements further processing instructions.

1 Like

Thank you both,

but TBH i cant get it to work.
As im new to icinga, its a little bit confusing what i can do and where i have to do changes.

Is there a guide? how i can create own check configs and variables?

Thank you.

Read the docs:

https://icinga.com/docs/icinga2/latest/

You can create your own check commands.

Examples:

object CheckCommand "check-snmp-storage" {
        import "plugin-check-command"
        command = [ "/opt/icinga/plugins/check_snmp_storage", "-2fr" ]
        arguments = {
                "-H" = "$address$"
                "-C" = "$snmp_community$"
                "-m" = "$storage$"
                "-w" = "$warn$"
                "-c" = "$crit$"
				"-o" = "$octetlength$"
        }
        vars.snmp_community = "moeglich"
        vars.warn = "90"
        vars.crit = "95"
	vars.octetlength = "5001"
}

object NotificationCommand "mail-host-notification" {
  command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ]

  env = {
    NOTIFICATIONTYPE = "$notification.type$"
    HOSTDISPLAYNAME = "$host.display_name$"
    HOSTNAME = "$host.name$"
    HOSTADDRESS = "$address$"
    HOSTSTATE = "$host.state$"
    LONGDATETIME = "$icinga.long_date_time$"
    HOSTOUTPUT = "$host.output$"
    NOTIFICATIONAUTHORNAME = "$notification.author$"
    NOTIFICATIONCOMMENT = "$notification.comment$"
    USEREMAIL = "$user.email$"
    NOTES = "$notes$"
    URL = "$notes_url$"
  }
}

Thank you,

i already figured it out by myself :slight_smile:

Thank you all