unic
(Rafael Voss)
August 21, 2019, 8:03am
1
Hi,
I’am trying to allow access to some objects with a custom variable that is an array. Its working if I’am using Wildcards, but not without it:
_host_sla=*someString*
is working
_host_sla=someString
is not working.
What is the correct syntax to check for an explicit array element?
Thanks for support!
Best regards,
Rafael
I do not know if you mean a simple array:
Service:
apply Service "storage-" for (storage_name in host.vars.storage) {
import "generic-service"
check_command = "check-snmp-storage"
icon_image = "custom/hdd.png"
vars.storage = "/" + storage_name
vars.warn = "90"
vars.crit = "95"
vars.sla = "24x7"
assign where host.address && host.vars.os == "linux"
}
Host:
object Host "dev" {
import "dev"
address = "address"
notes = "Development Server"
**vars.storage = [ "zpl", "dpl", "vpl" ]**
...
}
1 Like
dnsmichi
(Michael Friedrich)
August 21, 2019, 8:47am
3
Hi,
the database column doesn’t store an array, but a JSON representation of the DSL object, as string. Therefore you can only use a simple string match for your permissions, and no complex “x in arr” matches.
Cheers,
Michael
1 Like
unic
(Rafael Voss)
August 21, 2019, 2:40pm
4
Thanks for clarification. I tried to avoid wildcards because of the risk to add more permissions that I wanted. Will add some awareness then
Regards,
Rafael
1 Like