Server Management - Systems Insight Manager
1748073 Members
5268 Online
108758 Solutions
New Discussion юеВ

Re: Script to creat a System List based on a file with system names.

 
Alfredo Soares
Frequent Advisor

Script to creat a System List based on a file with system names.

Hi All,

Does anyone ever created or have a script to creat a System List on SIM based on a file with system names.
I would like to have this, t help me create a list of 200 server in 1000 that are in SIM, instead of picking one by one servers in the list os all servers.

Thank you

Alfredo Soares
12 REPLIES 12
Alfredo Soares
Frequent Advisor

Re: Script to creat a System List based on a file with system names.

Hi again,

No one have created such a script/tool??
I really need it, and i'm not so good on that area...

Thanks one more time

Alfredo
Todd Schelin
Valued Contributor

Re: Script to creat a System List based on a file with system names.

Alfredo,
Give this script a try it will create a new group list of servers for you to create an authorization for. Sounds like what you are looking for.
Todd Schelin
Valued Contributor

Re: Script to creat a System List based on a file with system names.

By the way you run this script from the CMS Server. It does not run from within the SIM interface. Copy the file to the server and then run it from the server.
Alfredo Soares
Frequent Advisor

Re: Script to creat a System List based on a file with system names.

Thanks Tood,

But I think I didn├в t, explain myself very well.
For the purpose of your script David Claypool posted one here ( see: http://forums2.itrc.hp.com/service/forums/questionanswer.do?threadId=587749 ).Thought I could not make it work so far.
What I really wanted, was a script or xml tool, that created a "System List" (left pane on SIM console...), based on a list of system names inside a file (txt file for example), using mxquery CLI command for example.
Because I have 1000 systems, on three different domains, and I want to create 3 system list, one for each domain, without having to select each system one by one.

Thanks all

Alfredo
David Claypool
Honored Contributor

Re: Script to creat a System List based on a file with system names.

Alfredo:

If you have a list of servers that you want to turn into a query, put them in a text file with the system name on a line by itself. Then, with a text editor or other programmatic means, at the beginning of each line you want the tag and at the end of each line you want . As such:

Mickey
Daisy
Pluto
Donald
Minnie

...and so on.

Once your file is formatted like that, open it up and at the beginning of the file put:





...and then at the end of the file, append





When you have done that, you use the mxquery command to add it to HP SIM, as in

mxquery -a -f FILNAME

On Windows, change to the c:\Program Files\HP\Systems Insight Manager\bin directory or on UX/Linux find it in /opt/mx/bin.

If you are logged into HP SIM via a web browser when you run the command, you will have to log out and log in again to have it appear.
Alfredo Soares
Frequent Advisor

Re: Script to creat a System List based on a file with system names.

Hi David,

Thanks a lot for you reply.I didn't answer earlier because I of the weekend.
Let see if I can explain myself well, whats happening now.

I tried to creat the file as you said here (can see attached file):

On line
query name="NAME-IT-WHAT-YOU-WANT"
in NAME-IT-WHAT-YOU-WANT, i put my a name, "TestList", for example.

On line
type="DeviceViews" category-name="EXISTING-CATEGORY-NAME">
in EXISTING-CATEGORY-NAME I put Public (Public is a Folder in System Lists that anyone can see).

If I run mxquery -l cat, I get a list and Public is there.

When I run the command mxquery -a -f test.xml, I get the error "C:\Program Files\HP\Systems Insight Manager\bin>mxquery -a -f test.xml
The name "Public" does not represent a query category in this system."

David, can you help me sort out what my be wrong??

Thank you

Alfredo
David Claypool
Honored Contributor

Re: Script to creat a System List based on a file with system names.

Most likely you don't already have a folder named Public. Use the [Customize] blue button located to the right of the [++][--} at the top of the lists box. Use the [New Folder] button to create the one you call "Public."
Alfredo Soares
Frequent Advisor

Re: Script to creat a System List based on a file with system names.

Hi David,

Thank you for your patience, but:

Yes..."Public" is a public folder I have created before.
Anyway, I created another folder (with public access), and tried with that one, but the same result:

The name "Dominios" does not represent a query category in this system.

Has I have told on the previous reply, if I run "mxquery -lcat", both "Public" and "Dominos" ( the new folder I have created ), are there:

NAME TYPE ACCESS OWNER
ClustersByStatus DeviceViews public simserver\mxadmin
ClustersByType DeviceViews public simserver\mxadmin
DevicesByOperatingSystem DeviceViews public simserver\mxadmin
DevicesByStatus DeviceViews public simserver\mxadmin
DevicesByType DeviceViews public simserver\mxadmin
Dominios DeviceViews public simserver\mxadmin
Public DeviceViews public simserver\mxadmin
SystemFunctions DeviceViews public simserver\mxadmin
EventSystemFunctions EventViews public simserver\mxadmin
Eventos Varios EventViews public simserver\mxadmin
EventsBySeverity EventViews public simserver\mxadmin
Hidden Queries ToolsViews public simserver\mxadmin

What am I missing????

Thank you

Alfredo
Alfredo Soares
Frequent Advisor

Re: Script to creat a System List based on a file with system names.

Hi again,

David?Anyone??Can spare a bite more time, try seeing what, am I doing wrong?
I really need this CLI to work...

Thanks in advance

Alfredo