How to Clean Niscache Folder on All Active Robots from the command line
search cancel

How to Clean Niscache Folder on All Active Robots from the command line

book

Article ID: 9570

calendar_today

Updated On:

Products

DX Unified Infrastructure Management (Nimsoft / UIM) CA Unified Infrastructure Management On-Premise (Nimsoft / UIM)

Issue/Introduction

This article describes a method to quickly and easily clean the niscache folder across all active robots in your UIM domain from the command line of a hub.

Occasionally, it becomes necessary to purge the niscache folder across all robots in a domain, and/or reset the device_id on every robot.

This is due to the behavior of probes creating niscache entries but not deleting them once a profile or probe has been removed from a robot. Using this approach, the niscache for each robot is deleted and the robot device id is reset. A list of robots containing the robots NimBUS addresses can be leveraged in large environments.

Environment

Windows or Linux (for Linux, "bash" command shell must be present.)

Cause

- outdated stored robot data, robot moves, robot changes, robot administration

Resolution

Instructions For Windows:

  1. Download the attached CleanNiscache.zip file attached to this KB Article.
  2. Unpack the zip file into the bin folder of your UIM installation folder
    1. In a default installation, this will be C:\Program Files (x86)\Nimsoft\bin
  3. Open the CleanNiscache.bat file in Notepad and change the PASSWORD line to match your UIM administrator password.
  4. Save the file and close it.
  5. Open the RobotList.txt file in Notepad and delete the existing-current contents.  (The initial entry is included to show the syntax required)
  6. RDP into your SQL server
  7. Open SQL Server Management Studio
  8. Run the following query:  (This query will only list robots that have 'checked in' within the last 24 hours), you can adjust the number of hours.

SELECT address FROM CM_NIMBUS_ROBOT WHERE alive_time > DATEADD(hh, -24, GETDATE()) AND robot_active = 1 ORDER BY is_hub;

  1. Click the header row to select all the rows that are returned
  2. Right click in one of the rows
  3. Click Copy
  4. Paste the results into the RobotList.txt file and save it
  5. Run CleanNiscache.bat to begin the clean up on all robots in RobotList.txt.

Instructions For Linux: 

  1. Download the attached linux_clean_niscache.zip file
  2. Unpack the zip file into the bin folder of your UIM installation folder
    1. In a default installation, this will be /opt/nimsoft/bin
  3. Open the cleanrobots.sh file in Notepad and change the PASSWORD line to match your UIM administrator password.
  4. Save the file and close it.
  5. Open the RobotList.txt file in Notepad and delete the current contents.  (The initial entry is included to show the syntax required)
  6. On your backend database run the following query:  (This query will only list robots that have checked in within the last 24 hours)

SELECT address FROM CM_NIMBUS_ROBOT WHERE alive_time > DATEADD(hh, -24, GETDATE()) AND robot_active = 1 ORDER BY is_hub;

  1. Copy the results into the RobotList.txt and save it.
  2. Run the script as follows:    ./cleanrobots.sh RobotList.txt

Additional Information

Note: In some cases, you may not be able to obtain the list of robots, or for some reason they may not be communicating with the hub, and you will need to reset the niscache/restart all robots by IP address only, meaning that you cannot use a NimBUS-style address to reach them.

In this case, you can use the same process outlined above, with a few changes:

1. Fill the RobotList.txt with the IP addresses of the robots you want to reset.  There are multiple ways to obtain such a list which won't be covered here, but the important thing is that you need a list of IP's that are reachable directly from a hub;  you will have to run this process on each hub, pointed at that hub's own robots (in other words, this process is hub-to-robot based and doesn't respect UIM tunnels.)

2. Edit the cleanrobots.sh/bat file and alter it as follows:

   a. For Linux, change: $PASSWORD $line/controller  to:  $PASSWORD -H $line

   b. for Windows, change: PASSWORD% %%A/controller  to:  PASSWORD% -H %%A

3. Execute the file as outlined above - now the probe utility will send commands to the IP given (on port 48002) instead of using the nimbus address.

 

Attachments

1696348034074___windows_clean_niscache.zip get_app
1696348024327___linux_clean_niscache.zip get_app