Attached zip (nimsoft_delete_device_v3.6.7.zip) contains a tool: nimsoft_delete_device that will remove the device in:
- via discovery_server probe callback (remove from usm)
- via hub probe callback (remove from IM)
- all related QoS data
- all related MCS\SSR QoS data
- all related alarms in nas_transaction_log and nas_transaction_summary
- via the nas probe callback (nameservice_delete)

Example1: nimsoft_delete_device.exe -h"servername"
This will simulate the delete of the server "servername". If the simulation is ok for you, you can add: -s"n"
Example2: nimsoft_delete_device.exe -f"c:/temp/delete_servers.txt"
This will simulate the delete of all devices in file: c:/temp/delete_servers.txt. (Note: use a "/" to specify the path)
The script is written for Windows and MSSQL/mySQL and compiled via the pp option in Strawberry Perl. The package contains the .exe and .pl versions)
The zip contains also a CentOS compiled version (.bin) (an older version)
In the zip file there is also a doc file that contains more info (you will need to change a file: nimsoft_generic.dat with server & user settings, this file is common between several utilities and is used to avoid creating parameters for user/password and server settings)
Version 3.0:
- if multiple cs_id's are found for a device, all will be deleted
- work together with a probe version of "delete device" so that you can delete a device via a nimalarm
Version 3.1:
- tested with version 9.0.2
- add option -p to activate "prevent_rediscovery" (y,n) default: n
Version 3.3:
- callback removerobot needed to be case sensitive (added lookup to find the correct case)
- reworked/retested the Perl setup environment chapter 3
- revised all print statements to make debugging easier
- when working with the Perl source, you will need 3 extra Perl packages installed (see chapter 3, last 3 cpan install statements)
- MCS code reworked, thanks to Swat team, to remove MVS profiles of the deleted device
- tested with 9.1 (or 9.0.2 sp1)
prepared to work with probe_decom (probe that will accept remove devices commands via a **** NimAlarm)
Version 3.4:
- nimsoft_generic.dat has a new parameter: sql_driver. This gives you the possibility to use another MSSQL driver needed for TLS 1.2
- tested with UIM 9.20
- new parameter -x. Source match on ip. Default: y. When set to: n we will run an "extra" search directly on s_qos_data to find matching qos metrics that have no ci_metric_id
Version 3.4.2:
- parameter -z"y" will use the single device, defined via -h, in the SQL WHERE clause. When deleting a single device this is now the recommended parameter to use; it will improve the execution performance (very much)
Version 3.6.4:
- when using a single device without regex activated (-r) the tool will switch automatically to single device mode for performance reasons; meaning that the SQL queries to obtain the QoS metrics will contain a WHERE clause with the device name.
- tested with 20.3.3 and Perl 5.32
- new version is posted at the end as: nimsoft_delete_device_3.6.4.zip (this name can be used to search for it in communities in case it does not appear as downloadable attachment)
Version 3.6.7:
- Tested under UIM 23.4.1
- MCS option needed a modification (the second delete did generate a conflict and it was not needed anymore)
- Change of sql query to select also qos metrics with missing fields
- Option –u can also delete profiles in CM_SNMP_INTERFACE & CM_SNMP_SYSTEM tables, default: n
Comments and ideas are very welcome.
(this is , like all other user written tools, only an example tool that I tested as good as possible)
Note1: if you run the tool in non-simulation mode and receive an error like: "rc=2 err=communication error from nimNamedRequest " this is probably due to an error in defining the correct variable values (specially Case is important) for uim_domain, uim_hub or uim_robot in the file nimsoft_generic.dat. Try to use your values in the command:
pu -u administrator -p ?? /your_domain/your_hub/your_robot/discovery_server get_snmp_devices
The debug option -d"p" can help you to generate this PU command.
Note2: the latest version is attached as an update at the end
Pre-requisite: this tool does require a robot installed locally on the device where you want to run this tool (to be able to login to UIM)
#uim #delete #device #tool #commandline #qos #alarm #perl