This is an example of how you can write a script to invoke Force Component Rediscovery for all SNMPcollector profiles
This is Windows script.
You can tweak / change to fit your environment.
set LIST=devicelist.txtset PU="C:\Program Files (x86)\Nimsoft\bin\pu.exe"set UIMUSER=administratorset UIMPASS=password
del %LIST%%PU% -u %UIMUSER% -p %UIMPASS% snmpcollector get_snmp_device ALL | findstr "ID" > %LIST%for /f "tokens=3 delims= " %%i in (%LIST%) do (%PU% -u %UIMUSER% -p %UIMPASS% snmpcollector rediscover_snmp_device %%iTIMEOUT 10)
The reason I had to develop the script was part of troubleshooting.
Some customers experiencing snmpcollector probe metrics display missing in UMP, very often it was resolved by component rediscovery.
Manual re-discovery operation for mass target is headache, so I developed this.
Yu_Ishitani Thanks for the validation. When thinking about this, I am trying to identify what USE Cases we would need to execute this script for. In your experience when people implement this script is it something that runs one a day, or is this something that some type of logic would kick this script of if a scenario was to occur?
I guess I am just wondering how often would someone want to run this "on every device" In larger environments I would think this would place un-wanted load in some cases if ran to often?
Sorry for late reply.
Yes. You are correct.
Yu_Ishitani I just want to make sure I understand this. To be clear this script runs and pulls the IDs from all SNMPCollector devices and then goes one by one and triggers them to run a component re-discover? Is this correct?
In the script, it sleeps 10 seconds in between loop since device rediscovery load vary device to device.
This is great! Question on the load that this might create? Is there a maximum number of devices that can or should be done at one time?
It is the name of a text file that will be created in the directory where you execute the batch file.
The outputs of the following command are redirected into that file with this command:
%PU% -u %UIMUSER% -p %UIMPASS% snmpcollector get_snmp_device ALL | findstr "ID" > %LIST%Then this file is read in the "for loop" to process all of the devIDs returned by the get_snmp_device callback.
for /f "tokens=3 delims= " %%i in (%LIST%) do
In the "for" loop, the rediscover_snmp_device callback is executed on each of the devices listed in the file.
Yu_Ishitani thank you very much for the contributions.
I have a question. You indicate this line (set LIST=devicelist.txt), but the devicelist.txt what is?
Thank you very much !
You are my hero of the week! Thanks Yu!
Hi, thank you very much for question.
device ID is an internal ID automatically assigned by the probe.
Are you using any specific data format for your devices.txt file? Is it the device IP, Name or the profile name as seen in snmpcollector?