Can someone walk me through this data import. I have hosts in Icinga. All have default service hostalive and this is working.
But i need to automaticly add a large number of services to these hosts. Either One service to one host (1-1). Or some smarter way since some of the services have the same command. These can be matched with “host_name” the variable below. I now want to import services via Director Automation. This is my current input file:
services.csv:
“host_name”;“display_name”;“check_command”
“t3333”;“A big check of things”;“check_nrpe!check_thisandthat -a BANANA”
“t2222”;“A big check of things”;“check_nrpe!check_thisandthat -a BANANA”
“t3333”;“A big check of things”;“check_nrpe!check_thisandthat -a KIWI”
etc etc…
This input file can be enriched, splitted or modified any way needed.
Could you point me in the direction of what is needed here. Im guessing i start with a Import source for this, wich works. Then a Sync Rule for object type: service. But how should the sync rule be configured?
Hi @Gustav,
You are on the right way
In the “Sync Rule”, under the “Properties” Tab you have to create some Properties. Since you are effectively creating a Service object (or many) you need at least a object_name (name of the created Service), a check_command (theoratically at least, practically use “Inheritance (Import)” and import a Service template of your choosing) and the targeted Host (host field).
In each “Property” you map a column of your input (or a hard coded value) to a part of the Service object.
Since the check_command in Icinga2 is different than in Nagios you have to split the check_command in your CSV at the ! to get the first part ( which is the CheckCommand in Icinga2 speak) and the arguments which have to be assigned somewhat differently.
I hope this helps somewhat. Keep us updated on the journey
I didn’t use NRPE lately so I am little bit rusty there.
I think there is a small misconception here about how Icinga2 works. In Nagiso (AFAIK) you defined the whole Command manually check_nrpe -a $ARG1$... , where Icinga2 abstracts the whole thing to a CheckCommand and the CheckCommandArguments, meaning basically that the arguments can generated in a more flexible way.
The variable nrpe_arguments (which you correctly found) is not "all the things after check_nrpe, but “The values to pass to the ‘-a’ argument of check_nrpe”.
So, the easy fix might be to remove -a from the CSV