Custom Website Monitor error when applying configuration

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Post Reply
lveitch
Posts: 18
Joined: Fri Mar 22, 2024 10:02 am

Custom Website Monitor error when applying configuration

Post by lveitch »

Hey gents!

So in my Nagios Core implementation, I have a server and under that I am monitoring a website using a custom check_http command that looks like this and it works great:

Code: Select all

/usr/local/nagios/libexec/check_http --ssl --sni -H $ARG1$ -s $ARG2$
Now on my NagiosXI server, I have tested the command (via terminal) and it also works great! So, I go to the CCM and add the custom command. Then I go to Monitoring > Services and select my server I want it to add that command to. I add it, and do the Run check command and everything comes back green finish all the required setup for the command and save. When I hit apply configuration, I get an error on screen:

Code: Select all

<div>Error: Service has no hosts and/or service_description (config file '/usr/local/nagios/etc/services/<my_servername>.cfg', starting on line 193)</div>
When I check the config file, there are no errors and the obviously the command never added to the config file and that particular line is actually a blank line. So why is it throwing that error? I have checked all the log files I can think of and cant find anything to tell me what the error is so I can fix it.
jsimon
Posts: 104
Joined: Wed Aug 23, 2023 11:27 am

Re: Custom Website Monitor error when applying configuration

Post by jsimon »

Hi @lveitch,

One difference here is that XI runs commands via services that you create in the CCM, as you did. All services MUST have a host or your configuration will fail. Before trying to add this command, please try running through the following process to make sure your configuration is healthy:

Go to Configure (top menu) -> Core Config Manager -> Config File Management (Left Frame - near the bottom under Tools)
Then click on the following buttons in this order:
  • Delete Files
  • Write Configs
  • Verify Configs
    • Check the messages on screen, if there are any errors, go and edit the relevant configs to resolve the errors.
  • Then repeat the "Delete, Write, Verify" steps again until there are zero errors returned by verify.
    • "Total Errors: 0"
  • If, and only if, the process succeeds with no errors please try applying the configuration ( Left Frame under Quick Tools ).
If you aren't getting successful output with this, you can try restoring a snapshot from before you started adding this service. (CCM>Quick Tools>Configuration Snapshots)

Once we have a healthy state confirmed, create a host to add your service to. Make sure to fill out all mandatory fields or your configuration will fail. (Note, Common Settings, Check Settings, and Alert Settings all have fields you want to make sure to complete, marked with a red asterisk, make sure to fill those out).

Once you have your host created you can add the service you were trying to add above. Make sure to fill out all mandatory fields there as well, including Description.

Adding the host first and then adding the service to it and making sure your service description has data should fix the error you're running into. Please let us know if you run into any more issues with this.
lveitch
Posts: 18
Joined: Fri Mar 22, 2024 10:02 am

Re: Custom Website Monitor error when applying configuration

Post by lveitch »

So my output was clean on the first attempt (shown below) and when I attempted to readd the service, it gives me the same error. I made sure to fill out the required fields (config name, description, max attempt checks, check period and notification period.

Any other possible ideas?

Code: Select all

Nagios Core 4.4.13
Copyright (c) 2009-present Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 2023-06-01
License: GPL

Website: https://www.nagios.org
Reading configuration data...
Read main config file okay...
Read object config files okay...

Running pre-flight check on configuration data...

Checking objects...
Checked 682 services.
Checked 77 hosts.
Checked 10 host groups.
Checked 0 service groups.
Checked 1 contacts.
Checked 2 contact groups.
Checked 156 commands.
Checked 10 time periods.
Checked 0 host escalations.
Checked 0 service escalations.
Checking for circular paths...
Checked 77 hosts
Checked 0 service dependencies
Checked 0 host dependencies
Checked 10 timeperiods
Checking global event handlers...
Checking obsessive compulsive processor commands...
Checking misc settings...

Total Warnings: 0
Total Errors: 0

Things look okay - No serious problems were detected during the pre-flight check
lveitch
Posts: 18
Joined: Fri Mar 22, 2024 10:02 am

Re: Custom Website Monitor error when applying configuration

Post by lveitch »

After some fiddling around I figured it out.

Even though I went to CCM > Monitoring > Services...filtered to my host I want to add a service to, then clicked Add New...

You STILL need to hit Manage Host (even though its not marked as required) and add the server in that creation as well because apparently the Add New is just a general window that appears and is not Add New to that specific host I had already pre-selected.

Not the most intuitive that if you filter to that machine and click Add New that you would be adding a new service as a whole and not to that specific machine. Might just be me but seems like a bad design idea or that the manage host should be marked as required or something.

I appreciate your help simon!
Post Reply