Login with Facebook

Tuesday, March 29, 2011

Script for creating NNMi Nodes in OMW

Create a New Node Group

Right Click the Server –> Configure –> Nodes

Create Node Group

After Creation check for the node group id defined under Unique ID by check the properties page





If Wscript.Arguments.Count < 7 Then
'Check that you spacified the nodes filename
wscript.echo "Usage cscript createNodes.vbs ""filename"" osType osVersion sysemType osBits agentBinFormat groupID"
wscript.echo "Ex for Adding SNMP hosts: "
wscript.echo "cscript creatennmnodes.vbs nnmnodes.txt SNMP V1 Other 32 n/a {9F30A9B2-0833-4341-A146-27E01DA4AADD}"

Set args = WScript.Arguments
arg1 = WScript.Arguments.Item(0)
osType = WScript.Arguments.Item(1)
osVersion = WScript.Arguments.Item(2)
sysemType = WScript.Arguments.Item(3)
osBits = WScript.Arguments.Item(4)
agentBinFormat = WScript.Arguments.Item(5)
groupid = WScript.Arguments.Item(6)

Set CSVoFS = CreateObject("Scripting.FileSystemObject")
nodesFile = arg1
Set file = CSVoFS.GetFile(nodesFile)
Set line = file.OpenAsTextStream(1,TristateUseDefault)
Do While line.AtEndOfStream <> True
myLine = Split(line.ReadLine,",")
nodeName = "" & myLine(0) & ""
call createNode()

End if

Function createNode()
Command = """D:\Program Files\HP\HP BTO Software\bin\ovownodeutil.cmd"" -add_nodewithtype -node_name " & nodeName & " -caption "& nodeName & " -ostype " & osType & " -osversion "& osVersion & " -systemtype "& sysemType & " -osbits " & osBits & " -agent_bin_format " & agentBinFormat & " -group_id " & groupID
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(Command)
'Do While Not oExec.StdOut.AtEndOfStream
'commandoutput = oExec.StdOut.ReadLine()
'Wscript.Echo commandOutput
End Function

Create a text file contain all you NNMi nodes name it nnmnodes.txt

Run the below command

cscript creatennmnodes.vbs nnmnodes.txt  SNMP  V1 Other 32 n/a  {9F30A9B2-0833-4341-A146-27E01DA4AADD}


Franky Vally said...


When I try your script, it tells me that your second loop does not have a do. When I comment out the do and the other two lines below, the script seems to be caught in a loop.

Any idea what is going wrong?

Thanks for your help.

Ronit said...

Hi Mahmoud,

Need some guidance on adding some HP SAN devices in my OVOU 8.35 environment.

Please guide me how to proceed.


Ayub said...

Question: in your command you using Unique ID {9F30A9B2-0833-4341-A146-27E01DA4AADD} which is different then the screen shot for node group?

Post a Comment