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

image

 

image

 

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}"

Else
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()
Loop

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
Loop
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}

Monday, March 28, 2011

OMW: List files on folder that didn’t modified within 30 minutes Part 2

 

nodeName = "."
Set dateTime = CreateObject("WbemScripting.SWbemDateTime")
dateTime.SetVarDate( DateAdd("n",-30,now()))
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & nodeName & "\root\cimv2")
Set colFiles = _
objWMIService.ExecQuery("Select * From CIM_DataFile Where Drive = 'C:' and Path = '\\Scripts\\' ")
'Wscript.Echo colFiles.Count 'echo number of files
For Each objFile in colFiles
IF objFile.LastModified < dateTime.Value Then
strNewFile = objFile.FileName & "." & objFile.Extension & " File last modified : " & objFile.LastModified
Wscript.Echo strNewFile
END IF
next


This script is for displaying files that are last modified date is older than 30 minutes


Here is the script breakdown with explanation


I tried to get the current time using Now() function then I deducted the time by using DateAdd() and used a native value


I called the files using WMI class  CIM_DataFile and I defined the file location through Where clause to filter the files that are located in drive C: and located under folder named \Scripts


objWMIService.ExecQuery("Select * From CIM_DataFile Where Drive = 'C:' and Path = '\\Scripts\\' ")


The problem that the time stored in WMI object is different that the time value used in VB script function like now() like the below


VB Time is 03/28/2011 9:42:03 PM


WMI Time is 20110328214201.225172+240


I have used WbemScripting.SWbemDateTime class to convert the date to WMI date


Set dateTime = CreateObject("WbemScripting.SWbemDateTime")

Then I converted the value received using a function named SetVarDate()


dateTime.SetVarDate( DateAdd("n",-30,now()))


I tried to compare it within the WMI query and failed so I compare it using if statement


If objFile.LastModified < dateTime.Value then
Wscript.Echo strNewFile

HP Network Node Manager i 9.0 deep dive

Saturday, March 26, 2011

NNMi: How to find Management Incidents that considered Key Incidents

 

I have analyzed the NNMi database, and found the below

The Key incidents are defined by the Incident Nature which can be found on the NNMi table NNM_INCIDENTS and the Incident name is stored under column "Name" and the correlation nature is stored under column "NATURE"

So after more analysis I found the below  table for mapping the value in nature column and map it to the correlation nature names used in the Incident Management views

image

so for Key correlation ( Root Cause, Service Impact, Stream Correlation,None, Info and  Rate Stream Correlation)

Value  Name

0    Root Cause
1    Secondary Root Cause
2    Symptom
3    Service Impact
4    Stream Correlation
5    None
6    Info

7    Dedup Stream Correlation
8    Rate Stream Correlation

I was able to get Incident Names them by the below Oracle SQL statement

   1: SELECT  "NNMI"."NMS_INCIDENTS"."NAME" as "NAME",COUNT(*)
   2:     FROM "NNMI"."NMS_INCIDENTS" 
   3:     WHERE ( ( "NATURE" = '0' ) OR ( "NATURE" BETWEEN '3' 
   4:     AND '6' ) OR ( "NATURE" = '8' ) ) group by Name

The result was the list below, but this may be expanded if you have more incidents from the system.

Note: This may be  the answer of your question

NnmHealthOverallStatus
SNMPAgentNotResponding
NodeDown
RateCorrelation
InterfaceDown
NodeOrConnectionDown
NonSNMPNodeUnresponsive
LicenseExpired
ConnectionDown
AggregatorLinkDegraded
LicenseNodeCountExceeded
AddressNotResponding
AggregatorDown









This was answer to question in HP Forum “NNMi List of Key Incidents”


http://h30501.www3.hp.com/t5/Network-Management-Support-Forum/NNMi-List-of-Key-Incidents/td-p/24529

Friday, March 25, 2011

Check the status of OMW nodes part1

I have create the below script to run opcragt command and check for the failure values and display the matching lines to the screen and this can be later used to write it in a log file for policy monitoring.

 

   1: If Wscript.Arguments.Count < 1 Then
   2:     wscript.echo "Usage cscript checkstatus.vbs ""nodename"" "
   3:     wscript.echo "Ex:"
   4: Else
   5:     Set args = WScript.Arguments
   6:     nodename = WScript.Arguments.Item(0)
   7:     call checkNode()
   8: end if
   9:  
  10: Function checkNode()
  11: Command = """C:\Program Files\HP\HP BTO Software\bin\win64\opcragt.cmd"" -status " & nodename
  12: Set WshShell = CreateObject("WScript.Shell")
  13: Set oExec = WshShell.Exec(Command)
  14: Do While Not oExec.StdOut.AtEndOfStream
  15:     commandoutput = oExec.StdOut.ReadLine()
  16:     subAgentError = instr(commandoutput, "isn't running") 
  17:     connectionFailed = instr(commandoutput, "failed") 
  18:     subAgentAborted= instr(commandoutput, "Aborted") 
  19:     if subAgentError > 0 Or connectionFailed >0 or subAgentAborted > 0 then
  20:         Wscript.Echo nodename & " : " & commandoutput 
  21:     end if 
  22: Loop

for two errors only (added the 3rd on 26 March)


1- When we run opcragt on a node that is on of the sub agents are failed the following error is displayed:


image


In line 16 I’d used instr() to filter and capture the error message


subAgentError = instr(commandoutput, "isn't running")

 

2- When we run opcragt on a node that is not accessible the following error is displayed


image


So I used the instr()  in line 17 to locate to filter the line for the error message


connectionFailed = instr(commandoutput, "failed")


 


3- When we run opcragt (opcagt) on a node that has a aborted subagent the following error is displayed

In line 18 I’d used instr() to filter and capture the error message

C:\WINDOWS\system32>opcagt
opcacta OVO Action Agent AGENT,EA (2064) Running
opcmsga OVO Message Agent AGENT,EA (4104) Running
opcmsgi OVO Message Interceptor AGENT,EA (3148) Running
opctrapi OVO SNMP Trap Interceptor AGENT,EA Aborted

 

Then I displayed the with filtered data contains the node name:


dc-dxb-01 : (xpl-316) connect() to '10.200.92.1:383' failed.
omw-dxb-01 : Action Agent opcacta isn't running
omw-dxb-01 : opctrapi OVO SNMP Trap Interceptor AGENT,EA Aborted


Thursday, March 24, 2011

OMW: Modify the Heartbeat settings for Managed Node

Recently I decided to post my replies in HP Support Forum here in my blog to enrich the internet with the direct answer to the question I may also attach some screenshots..

The question was about changing Hearbeat settings for OMW Nodes..

The settings are actually located under system tab in the node properties page

I will use WMI to handle this case

So node information is located in the instances of WMI Class named ov_managednode this class contain all the node related attributes plus more methods to execute different functions

This WMI class is located under WMI namespace “root\HewlettPackard\OpenView\data”

dealing with WMI in VB scripting is quite straightforward, although the scripts may look different

The code below is simple to connect to WMI on the local machine and direct the code to the namespace mentioned above

Set objLocator = CreateObject("WbemScripting.SWbemLocator") 
Set objNode = objLocator.ConnectServer("", "root\HewlettPackard\OpenView\data", "", "")
objNode.Security_.impersonationlevel = 3





 

The next section is to find the node where we want to modify in list of Instance of the ov_managedNode class so as long as we may use the full node name there is attribute contain this data called primarynodename so we will use a WQL to locate node(s) matches our select criteria and we will execute the query by objNode.ExecQuery() function


msgQuery = "Select * from ov_managednode where primarynodename = """ & nodeName & """" 
objNodeList = objNode.ExecQuery(msgQuery)


but in the query about you may notice nodeName which is a variable  where you my add it as argument while executing the script where we defined the nodeName as the 1st argument identified as Item(0)


argsObj = WScript.Arguments 
nodeName = argsObj.Item(0)


 


And finally to change the value of any attribute  you need to locate the attribute name and its possible values and use .put to write your changes.


Monday, March 21, 2011

Using VMware vSphere Client to connect to VMware Server

In Jan 2009 I created an article on How to use the Virtual Infrastructure Client to connect to VMware Server 2.0

Today, I hade another challenge where I want to use the latest client tool which is VMware vSphere Client to connect to an VMware Server it will give you the error below

image

image

image

 

"The required client support files cannot be retrieved from the server"
"The login process will now exit"
"Details: The server could not interpret the client's request. (404 not found)"


Solution was found in this link http://www.linux.com/community/blogs/accessing-vmware-server-2-with-vsphere-client-the-unsupported-way.html and simply download a rar file Here's a link expand the contents in the “Virtual Infrastructure Client” folder in Program files folder and rerun the tool it will work perfectly.


Note: This is not supported by VMware.