Server Management - Systems Insight Manager
cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Tool Paramenters in SIM 6.x

 
Highlighted
New Member

Custom Tool Paramenters in SIM 6.x

The Custom tools help does not demonstrate the repetition attribute well enough for me to use it.

I want to provide the list of systems names to a script. I can see from the help that %f is how I pass a single node name to a script

For example:

script.bat %f

That works fine, but I want to pass the entire list of nodes as arguments.

For example:

script.bat node1 node2 node3 ...

Does anyone understand how to use the repetition argument %( ... %) ?

I've tried many different iterations but can't find one that works.

For example all of the below cannot be expanded by SIM (according to the error message SIM provides at run time)

script.bat %f %( %f %)
script.bat %( %f %)
script.bat %( f %)
script.bat %( %f %)
script.bat %( %%f %)

Any insight would be appreciated.

1 REPLY 1
Highlighted
Honored Contributor

Re: Custom Tool Paramenters in SIM 6.x

Hi

 

The way I usually do it when dealing with this kind of issues is to generate a list of devices and then I ran my tool against the list using a loop...

 

 

I created a batch to delete devices from the sim database that works like this:

i generate the list using mxquery command then I parse it to delete what i want...

 

 

REM Create list of systems

mxquery -e "Not Reachable for the last 30 days" |find "DeviceName" >nodes1.txt

mxquery -e "Critical Systems" |find "DeviceName" >nodes2.txt

REM Parse them to extract the proper list of system to delete : using windows grep

"C:\Program Files (x86)\GnuWin32\bin\grep.exe" -f nodes2.txt nodes1.txt >nodestodelete.txt

REM Parse them to extract the proper list of system to delete : using cygwin grep copied in Openssh folder

“C:\Program Files\HP\OpenSSH\bin\grep.exe” " -f nodes2.txt nodes1.txt >nodestodelete.txt

REM Transform lines in columns

for /f "delims=" %%a in ('type "nodestodelete.txt"') do call :commande "%%a"

goto :eof

:commande

set ligne=%1

set ligne=%ligne:"=%

@echo %ligne% >>nodestodelete2.txt

echo off

REM Delete devices now

for /F "tokens=2" %%f in (nodestodelete2.txt) do @mxnode -r %%f -x force

 

The custom tool is based on this batch.

 

hope it  help

 

fred

“Life is pleasant. Death is peaceful. It's the transition that's troublesome.” Isaac Asimov