Hello!
I defined my own check command
object CheckCommand "check_fortiwlc_ap" {
import "plugin-check-command"
command = [
"/opt/monitoring/icinga/check_fortiwlc_ap.py",
"-l", "$username$",
"--url", "$url$",
"-p", "$password$",
"--ap", "$ap$",
]
}
For 1000 devices I would like defined only one service object:
apply Service "check_fortiwlc_ap" {
import "generic-service"
check_command = "check_fortiwlc_ap"
vars.ap=host.address???
vars.password = "test"
vars.url = host.vars.wlc ???
vars.username = "rest_api"
assign where vars.function_v == "access_point""
}
For every device I define host object:
object Host "{{ fqdn }}" {
address = "{{ host_address }}"
check_command = "hostalive"
{% if my_group is defined and my_group %}
vars.host_groups = [{{ my_group|join(' ,') }}]
{% endif %}
{% if json.status is defined and json.status %}
vars.status = "{{ json.status }}"
{% endif %}
{% if json.managed is defined and json.managed %}
vars.managed = "{{ json.managed }}"
{% endif %}
{% if json.platform is defined and json.platform %}
vars.platform = "{{ json.platform }}"
{% endif %}
{% if json.roles is defined and json.roles %}
vars.roles = "{{ json.roles }}"
{% endif %}
{% if json.mac_address is defined and json.mac_address %}
vars.mac_address = "{{ json.mac_address }}"
{% endif %}
{% if json.function is defined and json.function %}
vars.function_v = "{{ json.function }}"
{% endif %}
{% if json.serial_number is defined and json.serial_number %}
vars.serial_number = "{{ json.serial_number}}"
{% endif %}
{% if json.vendor is defined and json.vendor %}
vars.vendor = "{{ json.vendor }}"
{% endif %}
{% if json.model is defined and json.model %}
vars.model = "{{ json.model }}"
{% endif %}
{% if json.wlc is defined and json.wlc %}
vars.wlc = "{{ json.wlc }}"
{% endif %}
}
Is it possible that I assign variable in service instance from host instance for device that match conditions?
Tadeja