Tech Tip 5 - Auto Generate Service Groups

compared with
Current by Bren Eckles
on Apr 15, 2019 10:50.

This line was removed.
This word was removed. This word was added.
This line was added.

Changes (18)

View Page History
h14. Tech Tip 5 (11/2016) - Using the sg_autocreate script to automatically create service groups

The use case for this script is as follows:
The script itself is heavily modular and commented, making it an ideal example for extending to other, similar functions as needed. We welcome your contributions in this regard, as always, and your suggestions for improvement and more use cases.

h4. Here's how to install it:
h5. Here's how to install it

Download all the files:{attachments:patterns=sg_autocreate,sg_autocreate.conf,sg_autocreate_servicegroups.conf,agent_id,}
Save the changes to the file.

Now you will need to add the application type to foundation. Let's say you used "AUTOGROUP" like the example above, though you can call it anything you like. Log in to the web GUI as an administrative user, and click on GroundWork Administration, choosing the first item in the menu, Foundation. That will show you this screen:\\ \\
\\ !GW-fa.jpg|thumbnail,border=1!

Click on Manage Application Types, then click the grey Add Application Type button, and enter the app type you set in the file, e.g. AUTOGROUP. You should see it listed in the resulting screen:\\ \\
\\ !GW-fa2.png|thumbnail,border=1!

h45. Choose your service group members

Next, decide what the membership of the service group will be. You can have multiple services in one group or just one. If you are making use of service instances, you can choose to use the base name of the service or the suffix, depending on what you want. If you use the base name, all instances will be included. If you use the suffix, all services with that suffix will be included.
{note} the restrictions on service group names apply. No spaces are allowed. {note}

h45. Run the script and create the groups

Once you have it looking the way you want, you can run the script as user nagios:
Then check the Status view for your new service groups. They will be there within a few seconds.

h45. Cleaning up and formalizing

If you want to *remove* any of the groups you create in this way, just comment them out of the /usr/local/groundwork/sg_autocreate_servicegroups.conf file. They will be removed the next time you run the script.

Now whenever you run a commit, you will see the output from the script at the end. This will add some processing time. Depending on the size of your deployment, you may or may not want to do it this way.\\ \\
\\ !GW-mc.png|thumbnail,border=1!

h4. See also
See also:

The APIs we are using are all documented here:
* [dassMonarch|]
* [Foundation REST API|]

We hope you find this useful and informative. Thanks for reading\!