Delete server/device in UIM via command line tool (v2.9)

Document created by chrlu01 Employee on Jul 4, 2016Last modified by chrlu01 Employee on Oct 30, 2017
Version 14Show Document
  • View in full screen mode

A question that I receive with (almost) every client is: How do we delete device(s) in UIM/Nimsoft (in an user friendlly way)?

The latest available doc/discussion explained that this is a multi step procedure, certainly if you want also to delete the related QoS data.

 

Attached 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)

 

Selection parameters:

  -h: device(s) to delete

  -f:  path/file with devices to delete, 1 device per line, example: -f"c:/temp/delete.txt"

  -o: filter on origin

  -c: filter on dedicated

      (Device, VirtualMachine, Host, HostSystem)

  -r: enable regex expressions on flags -h,-o,-c (y,n) default: n

Delete parameters:

  -q: delete QoS (y,n) default: y

      (QoS will not be deleted if -c is used)

  -i: delete in hub/IM (y,n) default: y

  -a: delete alarm (y,n) default: y

  -m: delete MCS/SSR QoS entries (y,n) default: y

  -n: delete in NAS address table (y,n) default: n

Display parameters

  -l: list detailed list of selected QoS to delete (y,n) default: n

  -v: verbose on sql delete (y,n) default: y

Execution parameters

  -s: simulate run (y,n) default: y

Debug Parameters:

  -d: when using -d"p" you will receive in simulation mode the PU command needed to use the callback: remove_master_device_by_cskey

 

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 teh 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)

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)

 

Version 1.2:

- parameter -o makes it possible to filter on origin in regex format

- mssql trusted connection can be used

Version 2.0:

- mysql added

- delete alarms in nas_transaction_log and nas_transaction_summary

- delete mcs/ssr qos and definitions

- regex is now an option

Version 2.1:

- in the search of all robotnames the tool will only search the domain specified in the nimsoft_generic.dat file

Version 2.2:

- works now with MSSQL and MySQL

- Works now on Windows and Linux (tested on Centos7)

- included compiled version for Linux (.bin) and Windows (.exe) that should work on standalone servers (but with a robot installed)

Version 2.3:

- The step to delete the device in the robot table of the hub is now based on a simple SQL query instead of (time consuming) callbacks

Version 2.4:

- the -m option is modified to be compatible with UIM 8.51.

- delete device NAS addess table with the option -n

Version 2.5:

- add with(nolock) in the sql queries

- add debug option -d"p"

Version 2.6:

- add option -f, so that you can use a file, 1 server per line, to define the servers/devices to delete

Version 2.9:

- minor debug/message changes

- option -i"y", delete in hub/IM via removerobot callback, had a wrong callback address if the robot was on a remote hub

 

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: this version was fully tested on 8.5.1

If you want to run it on older 8.x versions you must use the -m"n" parameter so that the tool will not try to use the MCS/SSR tables from 8.4

(tested with -m"n" on 8.1 and 8.31)

Note2: 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.

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)

13 people found this helpful

Outcomes