At one of my clients they are using a custom build problem management tool + cmdb tool.
This means there’s not much flexibility of getting data in and out of these systems. At one point the question came to make a division between either critical servers and non critical servers to adapt the level of monitoring accordingly.
The only possible way to get the server list in was by supplying me with a txt file of all the critical servers.
So well… you can go and click away daily to compare the list with the group or automate the process… Of course I choose the second option.
By creating a new custom management pack that basically will read in the txt file on a regular basis and populate the group by deleting the servers which were removed and adding the new ones. So let’s get going.
The management pack can be downloaded here: Download management pack here
Things to adapt to your needs:
So now you have the xml file. Let’s import it in our environment and test:
Fire up your console and navigate to Administration > management packs
In the actions pane select Import Management Packs…
Select to import the management pack from disk by selecting add…
Click no at the following question. Browse to your management pack location and click import
Browse to your management pack location and click import.
Wait for it to import
When the import was successful you’ll notice the management pack listed in your mp list.
Check whether the group was created by going to the author tab > Groups.
The critical servers group was created but is empty at the moment because the discovery process did not run for the first time.
For this example I’ve created the extract.txt file with 3 servers who are currently residing in my environment.
After the first run of the script the servers are added to the group and the population has been completed.
To test whether the servers are dynamically removed I’ve removed VSERVER05 from the file and wait for the following run of the discovery.
and eureka! A couple of minutes later the server has been removed from the group:
Note: Make sure to not have empty lines in the file because this will trigger an End Of File (EOF) command and stop the script.
Now that you are sure that you always have the latest update of your critical servers group you can target this group for more strict monitoring or any additional overrides you specifically want to apply to these critical servers in your environment.
I’ve based my management pack on other community members who did similar projects:
Kevin Holman did it with populating groups from a CMDB which is SQL based: Populating groups from a sql server
Steve Rachui did it with a txt file and included several groups based on location: Populating from text file based on location