DX Infrastructure Management

Delete server/device in UIM via command line tool (v3.3) 

Jul 04, 2016 07:23 AM

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:

  -p: prevent rediscovery (y,n) default: n

  -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 (y,n) default: y

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

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

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

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 simple NimAlarm)

 

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, 9.0.2 and 9.0.2 sp1

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)

 

 

Statistics
0 Favorited
44 Views
1 Files
0 Shares
6 Downloads
Attachment(s)
zip file
nimsoft_delete_device_v3.3.zip   18.83 MB   1 version
Uploaded - May 29, 2019

Related Entries and Links

No Related Resource entered.