Permissions monitoring/filter/objects and Arrays

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

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

Thanks for clarification. I tried to avoid wildcards because of the risk to add more permissions that I wanted. Will add some awareness then :wink:

Regards,
Rafael

1 Like