I've just run auto-discover, or added several hosts, or changed the IP addresses of several hosts, and now my system says that my license is "approaching it's validity limit". I know I do not have more than my licensed number of hosts. What's going on? How can I make the system recognize the right number of hosts?
GroundWork Monitor counts devices in the foundation database, rather than hosts in the configuration database. This means that the true count that is being compared against the license limit is the number of entries in the Device table in foundation, not the number of hosts.
Devices can be created by the Configuration->Control->Commit or auto-discovery processes, by the reception of SNMP traps, or, if you configure it to do so, by syslog-ng. Also, when you re-IP a host, groundwork creates a new device, in order to preserve the historical data (events) on that device with the right name/IP address. Thus, if you generate a report on events, you will see the events associated with the device as named when the event arrived, not as it is currently named. This is by design.
Download the program devclean.pl if you are running GroundWork 6.1(click on the file name).
(This file exists on GroundWork versions 6.1.1 or greater at /usr/local/groundwork/tools/devclean.pl
Place this file on your groundwork server, and make it executable. This program must be run as root.
[root@myservername ~]# chmod 0755 devclean.pl
Running the program without any arguments gives you a report:
[root@myservername ~]# /usr/local/groundwork/tools/devclean.pl ======================================================== Number of devices Total: 987 Number of devices referenced by hosts: 456 Number of devices NOT referenced by hosts: 78 Number of devices probably created by traps: 32 Number of devices probably created by syslog messages: 21 ======================================================== Total Unused Devices: ###
This is what the numbers mean:
Number of devices Total:
This is the current total of all devices in the database, and would be what the license manager would look at.
Number of devices referenced by hosts:
This is how many devices you have that are monitored as Hosts in Nagios (via the Configuration Database). These are what are termed "core" devices. You can't really affect this number without deleting hosts in Configuration.
Number of devices NOT referenced by hosts:
These are the devices that could potentially be removed, since they are not associated with Hosts in Configuration.
Number of devices probably created by traps:
Number of devices probably created by syslog messages:
There are the devices created by the processes other than configuration (traps and logs, respectively).
Total Unused Devices:
This is the number of devices that are no longer referenced. They are kept in the database for historical data preservation only.
You should probably clean up at least the unused devices. Do this by running devclean:
[root@myservername ~]# /usr/local/groundwork/tools/devclean.pl -cleanup
Be aware that doing -cleanup will remove all LogMessage and performance data for these devices from the GWCollageDB (foundation) database.
If you no longer want to use devices created solely by snmptraps, you can also remove them:
[root@myservername ~] /usr/local/groundwork/tools/devclean.pl -cleansnmp
Of course, if you do this, the event console will no longer display events for deleted devices.
Perform a commit after this. Please run the devclean.pl script again after a day or so with no arguments to see what devices your system is actually monitoring.
If you do not care about Devices added by the SNMP trap process or syslog, you can make it more aggressive by changing the -cleanup to -cleanall. That will remove every device not in the configuration database. Note: If your GroundWork installation is still receiving snmptraps and/or syslog messages, devices will be newly created and the count will be increased, accordingly. Devices that you do not wish to be in your Total Number of Devices, should not be sending snmptraps or syslog messages to your GroundWork installation.
As of version 0.0.2 of devclean.pl, there is a more aggressive option, forceclean. This option is needed in cases where a device is in the device table, but all log messages pertaining to it have been removed, either by operator intervention, or by data retention processes. In the rare case where cleanup or cleanall does not remove devices NOT assigned to hosts, try the "forceclean" option in addition to cleanup or cleanall to remove these devices as well.
Note: Using this script deletes historical data! If that data is important to you, you may want to make a backup of the GWCollageDB database. It may not matter to you. mysqldump syntax: /usr/local/groundwork/mysql/bin/mysqldump -ucollage -pgwrk GWCollageDB > gwcollagedb-prior-to-devclean.sql |
[root@myservername ~]#./devclean.pl -h usage: devclean.pl [-h] [-v] [-d] [-cleanup |-cleanall|-cleansnmp | -cleansyslog] -h: print this help message -v: print the version number -d: turn on debug message -cleanup: Remove devices that are no longer used (removes Log Messages for these as well). -cleanall: Remove unused, snmptrap only and syslog only devices (most removal possible). -forceclean: Use with -cleanup or -cleanall. Removes devices that have no log messages associated. -cleansnmp: Remove snmptrap devices only. -cleansyslog: Remove syslog devices only.
./devclean.pl -> Prints a report of devices found. Does not delete any data.
./devclean.pl -cleanup -> Typical use. This will remove devices added by Configuration
and any log messages associated with them.
./devclean.pl -cleanup -forceclean -> Removes old devices, including those that have no log messages
to determine how they were added. Use this option to remove
devices when --cleanup alone does not get them all.
Note: Using the --forceclean option may delete devices that are classified as snmptrap or syslog generated. This is because it removes devices for which no historical massages exist in the database. Such devices may exist if you have been managing the data saved by trimming out old messages. This is by design, and usually desirable. |
If are not concerned with retaining any historical data you can delete all the devices from your system:
This will remove all the event data for all the devices in your system, though, so you might not want to take such a radical approach. |
You can remove ALL the devices in the system with a sql query from the command line:
source /usr/local/groundwork/scripts/setenv.sh mysql -ucollage -pgwrk GWCollageDB -e 'DELETE FROM Device;'
and then you can log in and access Configuration, remove the unwanted hosts, and commit your configuration again, to re-populate. You may also need to reset the database in this case. See Resetting your GWCollageDB
See Also: Resetting your GWCollageDB