DX Unified Infrastructure Management

 View Only
Expand all | Collapse all

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

  • 1.  Delete server/device in UIM via command line tool (v3.4)

    Posted Jul 07, 2022 12:59 AM
    Edited by Ashish Aggarwal Jul 07, 2022 12:58 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)

     

    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)

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

    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

    ​​​​​​​​


  • 2.  RE: Delete server/device in UIM via command line tool (v3.4)
    Best Answer

    Broadcom Employee
    Posted Nov 04, 2019 10:14 AM
    thanks for sharing

    ------------------------------
    Gene Howard
    Principal Support Engineer
    Broadcom
    ------------------------------



  • 3.  RE: Delete server/device in UIM via command line tool (v3.4)

    Posted Mar 03, 2020 06:33 AM
    Attachements for version 3.4.2 where a new parameter -w"y" can be used to delete a single device.
    With this option (-w"y") activated we will:
    - use the device name in the SQL WHERE clause
    - tool will only select the qos metrics for this device (without -w"y" the tool will read all qos metrics to be able to apply all regex filters)
    - you can still use the include/exclude regex parameters


  • 4.  RE: Delete server/device in UIM via command line tool (v3.4)

    Broadcom Employee
    Posted Mar 12, 2020 03:31 PM
    Hi Luc,

    Love the tool been using with customers for years.  

    Got a problem, might be something simple, we overlooked.

    UIM 9.20, MSSQL 2016 with AD logins only.

    We had to set the .dat file to use the SQL Native Client 11.0 but it keeps throwing errors for login isn't valid.  We used a nimsoft_crypt.ext to a user we know that access but it will just won't login.

    Any ideas?

    Thanks
    -Jay

    ------------------------------
    Customer Success Architect
    Broadcom
    ------------------------------



  • 5.  RE: Delete server/device in UIM via command line tool (v3.4)

    Posted Mar 13, 2020 10:41 AM
    New version will be posted that uses an ODBC system dsn to access with a Windows User that is not the logged on user.


  • 6.  RE: Delete server/device in UIM via command line tool (v3.4)

    Broadcom Employee
    Posted Mar 13, 2020 11:08 AM
    Awesome!  Thanks Luc!!!!

    ------------------------------
    Customer Success Architect
    Broadcom
    ------------------------------



  • 7.  RE: Delete server/device in UIM via command line tool (v3.4)

    Posted Oct 07, 2020 05:37 AM
    Luc

    seems the zip has be stripped off this discussion or I am looking in the wrong place

    Thanks, Andrew

    ------------------------------
    Knows a little about UIM/DXim, AE, Automic
    ------------------------------



  • 8.  RE: Delete server/device in UIM via command line tool (v3.4)

    Posted Oct 07, 2020 05:55 AM
    I agree that these communities website is not user friendly to find something.
    Try: https://community.broadcom.com/enterprisesoftware/communities/community-home/digestviewer/viewthread?GroupId=1315&MessageKey=8b76cd2a-ac64-4c22-a567-5b961387a172
    Is this better?


  • 9.  RE: Delete server/device in UIM via command line tool (v3.4)

    Posted May 20, 2021 05:05 AM
    It stays a mistery why sometimes the attachment can be seen and sometimes not.
    It helps to do a direct search on the name: nimsoft_delete_device_3.4.6.zip
    (only minor changes since 3.4.2)


  • 10.  RE: Delete server/device in UIM via command line tool (v3.4)

    Posted Jun 24, 2021 02:45 AM
    Edited by Luc Christiaens Jun 28, 2021 06:07 AM
    Latest version 3.6.4 (that contains some corrections on version 3.6 + automatically recognize single device mode for performance enhancement)
    Note: the discovery_server callback: remove_master_device_by_cskey is now (unexpected) also deleting qos metrics in step3 of this tool.  Therefor is it possible that step4 (= the delete of qos metrics) has 0 deleted qos metrics displayed.