Consolidated Services using Wizards

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Consolidated Services using Wizards

Post by chicjo01 »

When adding new hosts into NagiosXI, is there a way the wizards could use the existing services instead of creating one new ones for each host?

Example:

Hosts: Server A, Server B
Service: SNMP

Server A -> SNMP
Server B -> SNMP

Instead of:
Hosts: Server A, Server B
Service: Server A (SNMP), Server B (SNMP)

Server A -> Server A (SNMP)
Server B -> Server B (SNMP)
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Consolidated Services using Wizards

Post by Box293 »

In CCM, create services that are assigned to hostgroup(s) and not a host.

Then you can run a wizard, don't select any services to monitor but select the hostgroup it should belong to.

Now the host will get any services that those hostgroups are assigned to.

In these instances, skipping the wizard and just cloning an existing host in CCM is as powerful. Especially when you use templates which have the hostgroups defined in them.

Does this help?

I covered some of this in my presentation on Nagios XI Best Practices:

https://www.youtube.com/watch?v=6WlZrG-_sAI
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Consolidated Services using Wizards

Post by chicjo01 »

Thank you for the video, it has helpful information.

Your suggestion makes sense, but doesn't fit 100% with our vision. We are attempting to integrate our inventory system with NagiosXI, to be updated automatically once a day. The integration will add new equipment and hostgroups (As Needed) and move around already existing equipment in NagiosXI. My questions comes from the situation where new equipment get added and the hostgroup does not already exist, so the services would need to be identified and attached to the newly created hostgroup.

Could a wizard scan the host and assign already built services to the newly created host or hostgroup, instead of creating duplicate services?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Consolidated Services using Wizards

Post by Box293 »

chicjo01 wrote:ould a wizard scan the host and assign already built services to the newly created host or hostgroup, instead of creating duplicate services?
Unfortunately not, the wizards are not that smart.
chicjo01 wrote:We are attempting to integrate our inventory system with NagiosXI, to be updated automatically once a day. The integration will add new equipment and hostgroups (As Needed) and move around already existing equipment in NagiosXI.
How are you planning on automating this? There are a couple of different ways in XI so I would like to know this first before I give advice.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Consolidated Services using Wizards

Post by chicjo01 »

Thank you for the information.

We plan to use the Nagios API to Pull/Push data in NagiosXI and compare it with the server. But, we recently encountered a problem which could force us to start over from scratch.

We can pull data from NagiosXI via the API just fine as well as push new hosts, hostgroups, and services. The problem is the lack of API calls to associate them together. Does the Nagios API have calls to link hosts, hostgroups, and services together?

API Calls:

config/host
??? - API Call to host_to_hostgroup
config/hostgroup
??? - API Call to service_to_hostgroup
config/service
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Consolidated Services using Wizards

Post by Box293 »

chicjo01 wrote:The problem is the lack of API calls to associate them together. Does the Nagios API have calls to link hosts, hostgroups, and services together?
Because the API is new in XI 5, this ability does not exist yet. I've created a feature request, TASK ID 7193.

I did discover that you can re-add an existing hostgroup, however it will overwrite the existing members. Hence you need to get a list of members in the group first (hosts and hostgroups). I tried using the XGET however it does not return the members:

Code: Select all

curl -XGET "http://10.25.254.220/nagiosxi/api/v1/objects/hostgroup?apikey=en097kcs&pretty=1"

{
    "hostgrouplist": {
        "recordcount": "2",
        "hostgroup": [
            {
                "@attributes": {
                    "id": "160"
                },
                "instance_id": "1",
                "hostgroup_name": "test_group1",
                "is_active": "1",
                "config_type": "1",
                "alias": "test_group1"
            },
            {
                "@attributes": {
                    "id": "145"
                },
                "instance_id": "1",
                "hostgroup_name": "linux-servers",
                "is_active": "1",
                "config_type": "1",
                "alias": "Linux Servers"
            }
        ]
    }
}
I've create a feature request to be able to get all the details of an object when using XGET, TASK ID 7194.

To get past this hurdle, you could use the nagios JSON API to perform a query.

Code: Select all

URL: http://10.25.254.220/nagios/cgi-bin/objectjson.cgi?query=hostgroup&hostgroup=test_group1

{
    "format_version": 0,
    "result": {
        "query_time": 1449448707000,
        "cgi": "objectjson.cgi",
        "user": "nagiosadmin",
        "query": "hostgroup",
        "query_status": "released",
        "program_start": 1449448698000,
        "last_data_update": 1449448698000,
        "type_code": 0,
        "type_text": "Success",
        "message": ""
    },
    "data": {
        "hostgroup": {
            "group_name": "test_group1",
            "alias": "test_group1",
            "members": [
                "localhost",
                "localhost2",
                "localhost3"
            ],
            "notes": "",
            "notes_url": "",
            "action_url": ""
        }
    }
}
However from what I've found, the members list is actually the combination of all hosts and hostgroups, so if you had nested hostgroups this might be a problem.

Here's some info on the JSON API:
https://labs.nagios.com/2014/06/19/expl ... -7-part-1/

Not sure how much of this is helpful.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Consolidated Services using Wizards

Post by chicjo01 »

Thank you for the creating the Tasks for the API calls to be reviewed and hopefully created.
User avatar
hsmith
Agent Smith
Posts: 3539
Joined: Thu Jul 30, 2015 11:09 am
Location: 127.0.0.1
Contact:

Re: Consolidated Services using Wizards

Post by hsmith »

I'll leave this open for now. Please let us know if you come across anything else regarding this that may warrant a feature request. If not, please do not bump the post, as there is already a FR in and that's about as far as we can go on support. Thanks!
Former Nagios Employee.
me.
User avatar
chicjo01
Posts: 194
Joined: Tue Jul 28, 2015 2:52 pm

Re: Consolidated Services using Wizards

Post by chicjo01 »

How do I get a status on the below TASK ID, do you have a URL or a tracking system for features?

TASK ID 7193 and 7193
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: Consolidated Services using Wizards

Post by rkennedy »

The tracking system is internal only. I looked at 7193, and 7194 - at this point they are still in the developers to-do pool.

Feel free to post back when you'd like to check for an update once again.
Former Nagios Employee
Locked