i’m using the oracle_health plugin to check a lot of different database metrics. because some hosts have dozen of DBs i used an array in the service config. everything is working fine so far.
the oracle_health plugin has different modes, every mode is a different check…for instance “connected users”. now i want to set a custom warning/critical value exactly for this one check mode (connected users). the vars are “vars.oracle_health_warning” and “vars.oracle_health_critical” - every check mode use this vars to define custom warning/critical values!
i can do that global for all databases…
Service:
apply Service “Oracle Users " for (db => config in host.vars.db_instances) {
import “generic-service”
check_command = “oracle_health”
vars.oracle_health_connect = db
vars.sections = [ “database” ]
vars += config
vars.oracle_health_mode = “connected-users” vars.oracle_health_warning = 100 vars.oracle_health_critical = 200
display_name = “[” + db + “]” + " Connected Users”
assign where host.vars.dbcheck == “oracle”
}
but i want to do that for a specific database (DB1 in the following example), so i think i’ve to edit the host object vars…
the problem is, i dont know how i can do that just for the connected-users check because every service check (oracle_health_mode) needs his own vars.oracle_health_warning values. should i use an if clause or something else?
but that changes the warn/crit value for all check modes of oracle_health, so this is not a solution. i just want to change the values for the connected-users check.
2.) second attempt
i tried to overwrite the values only for the connected-users check-mode…
If you want to do it this way, you need to put logic into your apply rule and use vars.oracle_health_mode.connected-users to match and then overwrite the defaults only for this mode.