First attempt to create NAMEs for HASHes and insert them into the CON_SQL_NAME table. There are known limitations:
- the CON_SQL_NAME table requires a unique HASH and a unique NAME
- the CON_SQL_NAME table does NOT currently handle duplicate HASH numbers generated in different monitored instances
- the code only creates HASH/NAME pairs for HASHes that are unique across all monitored instances
Be advised, the code is TSQL so it will likely have to be updated to work in other flavors of SQL.
- Create a cursor from COND table to loop through tables associated with a monitored instance
- For each monitored instance, collect all HASHes from CON_STATS_..._X
- For each monitored instance, collect all HASHes and NAMEs from CONST_X where P = 0 and PNAME is not null
- Identify the HASHes that have a corresponding PNAME and limit the result only to HASHes that occur once in the entire list.
- Create a unique NAME up to 100 characters from up to the first 91 characters of the PNAME and appended with the HASH in hex with a leading underscore
- Delete anything in CON_SQL_NAME that does not exist in the list excluding default values provided by Solarwinds
- Update anything in CON_SQL_NAME that exists in both
- Insert anything that only exists in the list