Command, how can i use a simple check towards a windows machine in Director

So, this is driving me nuts. I really dont understand how I could get the commands working in the director. CLI is working fine, no issues there. I´ve even gotten the powershell self service portal working but i cannot even figure out how to get a simple command working.

So to start with my director is totally empty of commands, perhaps it should be like that. hostalive and other simple checks working from the cli is not working from the director. I always get a fault about the lookup location /usr/lib/nagios/plugins. Lets proceed with a check that is actually located there like check_ping.

SO in the command i have written check_icmp and arguments "H x.x.x.x -w 3000.0,80% -c 5000.0,100% -p 5

I have tried with $HOSTNAME$ the actual fqdn or short dns (which is working from the server) and i always get, failed to resolve

I have tried with PluginDir + /check_icmp

I have tried more simple arguments and always failed to resolve.

I cannot understand how hard it should be…I thought DIrector should make things more simple

How do i get check like for example hostalive to work in director. Or basically anything to work?

I probably only need some examples to understand

I should probably add that I have one mMaster running Ubuntu 18.04 and a client running the same OS

Icinga2 Version is r2.11.2-1 . Kickstart wizard and everything else seemed to work fine

Hi & welcome to the community,

first, how did you install Icinga 2 and the Director? The docs points you to running the kickstart wizard which also imports the pre-defined check commands from the Icinga Template Library. That being said, commands like hostalive or disk should already exist.

Each command in the Director needs exported fields as arguments, that’s a manual step you need to go before defining an actual host, service template and apply rules/service sets.

You don’t need to re-create icmp for example. That’s already available and ready-to-use. Navigate into Commands > External Commands and search for it.

I wrote a howto in the past which targets this topic with Windows agents: Director Service Sets: Add service checks based on host templates

Always keep it simple for the beginning though, and re-use existing command definitions before you go into advanced checks.

Cheers,
Michael

1 Like

Hello Michael, I followed the guide in the official library. Everything seemed to work fine. However I do not have any external commands. A search results in nothing.
Yep I am trying to keep it simple, and it´s a lot harder than nagios. Part of it could be the absence of all commands though.

So do I have to rerun the kickstart wizard. is it possible or how do I get the commands.

Maybe you missed the part about the “Kickstart” in the Director documentation? This way it imports all existing external commands.

1 Like

Well it depends if you are talking about this part. I have done this and it worked fine. I did all the steps but I still don´t have any external commands

Run the graphical kickstart wizard

Choose either Icinga Director directly from the main menu or navigate into Configuration / Modules / director and select the Configuration tab.

Either way you’ll reach the kickstart wizards. Follow the instructions and you’re all done!

Then maybe your Icinga Installation does not know about your command? icinga2 object list --type checkcommand should show lots and lots of entries. (19911 lines in my case) If that’s the case, we can rule this source of error out.

Yep, that is correct. I have a similar amount of rows running that command. Exactly 19981
So all the commands seems to be there but doesn´t load in the director

What exactly does the message say? (In the icingaweb2 interface I assume?)
Does the constant PluginDir point to the correct directory, where the plugins are located.
Are there any error messages when running the kickstart wizard?

Hello log1c. Well it basically says that the check isn´t in that directory. Which it isnt. What i found strange was that ordinary checks like hostalive wasn´t available in director. But something musta have gone wrong during the kickstart I imagine even though I am 100% certain it went well without issues

Plugindir points to const PluginDir = “/usr/lib/nagios/plugins”

I don´t know if that is standard or not but there are only a couple nagios checks available there

Should i rerun the kickstart or what is the best solution here

I rerun the kickstart. I don´t know if its required to parse addition parameters in the initial command?

Seems to be missing the object_name

The command written was icingacli director kickstart run

ERROR: RuntimeException in /usr/share/icingaweb2/modules/director/library/Director/Data/Db/DbObject.php:853 with message: Storing icinga_apiuser[] failed: SQLSTATE[23000]: Integrity constraint violation: 1048 Column ‘object_name’ cannot be null, query was: INSERT INTO icinga_apiuser (object_name, object_type, disabled, password, client_dn, permissions) VALUES (?, ?, ?, ?, ?, ?) {array (
‘id’ => NULL,
‘object_name’ => NULL,
‘object_type’ => ‘external_object’,
‘disabled’ => ‘n’,
‘password’ => NULL,
‘client_dn’ => NULL,
‘permissions’ => NULL,
)}

For running the command from the CLI you need a kickstart.ini file:

# icingacli director kickstart run --help
Trigger the kickstart helper
============================

This will connect to the endpoint configured in your kickstart.ini,
store the given API user and import existing objects like zones,
endpoints and commands.

/etc/icingaweb2/modules/director/kickstart.ini could look as follows:

   [config]
   endpoint = "master-node.example.com"

   ; Host can be an IP address or a hostname. Equals to endpoint name
   ; if not set:
   host = "127.0.0.1"

   ; Port is 5665 if none given
   port = 5665

   username = "director"
   password = "***"

if you do the whole thing via the web interface the director will ask these information to be input by you.

Which Director version are you using?

Michael: It is 1.7.1
log1c: Great Thanks, I will try running that from CLI aswell. I did the kickstart using the GUI the first time. seemed to work fine, but i figure it didn´t

Just wanted to let you know that rerunning the kickstart wizard through the cli solved the problem. All the commands are now available. Thanks alot for the help! I am sure things will get a lot easier now to start with atleast