log1c
December 3, 2021, 9:30am
10
The problem is not the applied service but the “apply for”.
There is a issue for this, but without any recent updates and it has been moved from milestone to milestone over the years.
opened 10:17AM - 03 Mar 17 UTC
ref/NC
area/apply-assign
I'm trying to override a service variable in the host to set a threshold for eac… h partition.
The generated override only matches the Name of the Apply Rule - not the individual generated services of the apply rule - as you can't select the generated service I guess overriding apply for services isn't possible (yet)?
```
object Host "BAPM0" {
import "OurLinuxHost"
address = "172.31.15.43"
groups = [ "linux", "sysE" ]
vars.disks = [ "/home" ]
vars._override_servicevars = {
"Disk Mountpoint " = {
disk_crit = "5%"
}
}
}
```
Service Template + Apply For
```
template Service "Disk Mountpoint" {
import "[Template] ssh-service (active)"
vars.by_ssh_command = "~/libexec/check_disk.lin -w $disk_warn$ -c $disk_crit$ -p $disk$"
vars.disk_crit = "10%"
vars.disk_warn = "15%"
}
apply Service "Disk Mountpoint " for (config in host.vars.disks) {
import "Disk Mountpoint"
assign where "linux" in host.groups && host.name == "BAPM0"
vars.disk = config
import DirectorOverrideTemplate
}
```
Cool would be to have the possibilty to create an override like this
```
vars._override_servicevars = {
"Disk Mountpoint /home" = {
disk_crit = "5%"
}
}
```
I couldn't find any open bugreport regarding this.
Overrides for “normal” applied services (coming from a single apply rule or a service set) work without problems