Login with Facebook
Showing posts with label Operations Manager Windows. Show all posts
Showing posts with label Operations Manager Windows. Show all posts

Sunday, July 31, 2011

Configure OMW to forward all events to OMi

1- Configure OMW to forward all events to OMi

a- Create Server-Flexible Management Policy

---

TIMETEMPLATES
# none

RESPMGRCONFIGS
RESPMGRCONFIG DESCRIPTION "Forward all messages to HP OMi"
SECONDARYMANAGERS
ACTIONALLOWMANAGERS

MSGTARGETRULES
MSGTARGETRULE DESCRIPTION "forward all messages rule"
MSGTARGETRULECONDS
MSGTARGETRULECOND DESCRIPTION "forward all messages "
MSGTARGETMANAGERS
MSGTARGETMANAGER
TIMETEMPLATE "$OPC_ALWAYS"
OPCMGR IP 0.0.0.0 "dxb-bsm-01.mahmoudthoughts.com"
---
replace dxb-bsm-01.mahmoudthoughts.com with your OMi server.
 



image


b- Deploy the newly created policy to your OMW server and ensure it is enabled.


2- Configure HPOM Topology Sync


On BSM Console


Click Admin > Platform > Setup and Maintenance > Infrastructure Settings 


Under Select Context select Operations Management from Applications


image


Browse to Operations Management - HPOM Topology Synchronization Connection Settings Section


Type your OM Server Hostname, User, password and change other options as needed.


image


Run opr-startTopologySync.bat from BSM bin directory


%TOPAZ_HOME%\bin\opr-startTopologySync.bat



image


Check the result on Modeling Studio


Admin > ODB Administration > Modeling > Modeling Studio 


Select Views from Resource Type list


Select OM CI Collections  from Root > Operations Management


image


Click on Preview Icon


 


image


The Result should be the Node, Node Groups and Service Hierarchy





image


3- list the events forwarded by OMW


Click on Application > Operations Management


The list of events should be displayed under Event Perspective


image





In the video below I captured 30 seconds on generating test messages from OMW and how fast it shows in OMi


Message Sync between OMW and OMI

Wednesday, April 20, 2011

OMW: Script to Change Agent from DCE to HTTPs Part2

Many administrators looking to automate the time consuming process, I had seen requests in HP support forums on how to change agent in bulk

I have created the below script which utilizes Policy Management and Deployment (PMAD) API which mainly starts by

set pmad = CreateObject("PMAD.OvPmdPolicyManager") 
pmad.ConnectDB


We can compare the above lines by opening the Node Editor


Set node = PMAD.CreateNode(nodeGuid)


The line above is locating or creating a node typically like Selecting the node you will modify the agent attributes.


createnode = node.ChangeAgent(liAgentCommType,wminode.AgentBinaryFormatId,256, "", "")


The lines above is like right click the node and select Change Agent which is executed by ChangeAgent() function which should be formatted like ChangeAgent(lAgtType,lBinaryFormat,ulOptions,sUser,sPwd)


lAgtType
- Defines the communication type of the HP Operations agent (DCE or HTTPS) that should run on the node.

lBinaryFormat
- Defines the binary format of the HP Operations agent that should run on the node.

ulOptions
- Defines the type of authentication that will be used for the operation



  • PMAD_DEPL_NONE_OPT - This flag cannot be combined with any other flags. Use this flag when you do not want to pass any other flags.
  • PMAD_DEPL_IGNORE_OWNER_OPT - If this flag is NOT SET, the operation fails if some policies are owned by another management server. If this flag if SET, the owner attribute of the policies is ignored.
  • PMAD_DEPL_FORCE_OPT - If this flag is NOT SET, the operation fails whenever there are policies in the inventory on the server for which no data is available. However, if this flag is SET, policies with no data are ignored (that is, not deployed again).
  • PMAD_DEPL_IMPERSONATE_OPT - If SET, the remote managed node is accessed with the security context of the impersonated user (the user that called this API).
  • PMAD_DEPL_PMADUSER_OPT - If SET, the remote managed node is accessed with the security context of the HP-OVE-Deleg-User account (the one under which PMAD is running).

Which I chose PMAD_DEPL_IMPERSONATE_OPT which uses the current user this options has a hex value 0x100 and the ulOptions means unsigned long which means a non negative decimal value which means here 256


sUser
- Name of the account used to access the remote node. You can specify the account either as a user principal name (UPN such as UserName@DomainName) or in the down-level log-on name format (DomainName\UserName).
sPwd
- Password of the account used to access the remote node.

 


The Full script


Dim nodeName
Dim agent
Dim argsObj
Set argsObj=WScript.Arguments
If argsObj.Count=2 Then
nodeName = argsObj(0)
newAgentType = argsObj(1)
Else
WScript.echo "usage: cscript.exe ovchgagent.vbs <nodeName> <agenttype>"
WScript.Quit (1)
End If
Dim objLocator
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Dim objNode
Set objNode = objLocator.ConnectServer("", "root\HewlettPackard\OpenView\data", "", "")
objNode.Security_.impersonationlevel = 3
Dim msgquery
msgquery = "Select * from ov_managednode where primarynodename = """ & nodeName & """"
Dim objNodeList
Set objNodeList = objNode.ExecQuery(msgquery)
Dim nodeGuid
Dim wminode
For Each wminode In objNodeList
nodeGuid = wminode.Name
wscript.echo nodeguid
Next
Set wminode = Nothing
Set objNodeList = Nothing
Set objNode = Nothing
Set objLocator = Nothing
Dim pmad
set pmad = CreateObject("PMAD.OvPmdPolicyManager")
pmad.ConnectDB
If pmad.DBConnected And nodeGuid <> "" Then
Select Case newAgentType
Case "n/a":
liAgentCommType = 0
Case "DCE":
liAgentCommType = 1
Case "HTTPS":
liAgentCommType = 2
End Select

Dim node
Set node = PMAD.CreateNode(nodeGuid)
createnode = node.ChangeAgent(liAgentCommType,wminode.AgentBinaryFormatId,256, "", "")
Set node = Nothing
Else
wscript.echo "node not found or invalid, or cannot connect to database!"
End If
Set pmad = Nothing

Tuesday, April 19, 2011

OMW: Script to Change Agent from DCE to HTTPs Part1

HP Operations manager prior to version 8, managed node are monitored through Agent uses RPC/DCE communication, which had lots of issues as it is unsecured communication and communication configuration headache for the Agent and Server through firewall

In HP Operations Manager 8  and later a new Agent is introduced called HTTP agent which uses encrypted HTTPs certificate-based communication to secure the data and uses only single port for the communication between OM and Agents ( TCP 383 by default)

So organizations with DCE Agents should be change the agent to HTTPS based to leverage the new features. the process is quite simple as the Administrator should access the Node Editor and Change the agent

To change the agent type

Open Node Editor by Right click Server Node > Configure > Node

Select Node and right click select Change Agent

image

This process will performs deployment operation as the following steps:

  1. Removes all packages and policies that are currently installed on the node.
  2. Deletes the server inventory for packages for the specified node, but keeps the server inventory for policies.
  3. Changes the agent type, binary format, or both of the node in WMI.
  4. Deploys the new binary of the HP Operation agent to the node.
  5. Redeploys all policies that were previously installed on the node (they are still in the server inventory) to the node. The additional agent packages and the instrumentation that is required by these policies are automatically deployed first.

Part 2 Click here

Monday, April 4, 2011

OMW:Read Multi-lined log files

I had seen so many questions about joining multiline log  as in OMW the Log Interceptor is parsing line by line, so if your data is scattered on different lines it can not be monitoring unless you imply a pre-processing script.

 

I have created the below script is to join multiple lines together but if match a certain keyword

If Wscript.Arguments.Count < 2 Then
wscript.echo "Usage cscript joinlines.vbs ""logfilepath"" ""machingtext"" "
wscript.echo "Ex:"
wscript.echo "cscript joinlines.vbs ""d:\logs\filename.log"" logfilename "
Else
Set args = WScript.Arguments
arg1 = WScript.Arguments.Item(0)
match = WScript.Arguments.Item(1)
Set fsObject = CreateObject("Scripting.FileSystemObject")
nodesFile = arg1
Set file = fsObject.GetFile(nodesFile)
Set line = file.OpenAsTextStream(1,TristateUseDefault)
dim arrFileLines()

Do Until line.AtEndOfStream
Redim Preserve arrFileLines(l)
arrFileLines(l) = line.ReadLine
l = l + 1
Loop
For l = Ubound(arrFileLines) to LBound(arrFileLines) Step -1
If Instr(arrFileLines(l), match) > 0 then
wscript.echo "maching line " & arrFileLines(l-1) &" " & arrFileLines(l)
end if
Next

End if


Save the contents to joinlines.vbs


It can be implemented in different ways:


You can create a log file policy to search for your error message in each line as the sample below


20110326 08:00:13 expdp_SHARED_DATASTAGE.sql started ok
20110326 08:14:13 expdp_SHARED_DATASTAGE.sql completed ok with this output:
The job "EXPDP_USER". "SYS_EXPORT_SCHEMA_06" failed at 08:15:00: ERROR
20110327 08:00:13 expdp_SHARED_DATASTAGE2.sql started ok
20110327 08:14:13 expdp_SHARED_DATASTAGE2.sql completed ok with this output:
The job "EXPDP_USER2". "SYS_EXPORT_SCHEMA_02" failed at 08:15:00: ERROR
20110328 08:00:13 expdp_SHARED_DATASTAGE3.sql started ok
20110328 08:14:13 expdp_SHARED_DATASTAGE3.sql completed ok with this output:
The job "EXPDP_USER2". "SYS_EXPORT_SCHEMA_03" failed at 08:15:00: ERROR


1- You may create your rule to search for the word error and to send message and we can use the script as automatic action to get the previous lines and to append it to the annotation


Sample screenshots


image


image


2-You can create the policy to pre-process the log  and write the output to a text file to be read.


cscript /nologo log.vbs backup.log ERROR >c:\windows\temp\joinedlines.txt


image 


 


Ref: http://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1474985

Saturday, April 2, 2011

OMW: Log file monitor for multiple log files

To monitor multiple files using a OMW log file monitor policy, you have to configure the policy to list those files separated by spaces.

Normally in Unix-based systems if you used ls command with wildcards, the result will be the full files path and separated by spaces

In Windows, dir is not delivering the same result as

if you try dir /b /s it will show each file in separate line

image

if you used /w command it display the files without path, so I created the below script to list the files with /w and add the path to the output

If Wscript.Arguments.Count < 2 Then
wscript.echo "Usage cscript listlogs.vbs ""directry"" filename "
wscript.echo "Ex:"
wscript.echo "cscript listlogs.vbs ""d:\logs\"" logfilename "
Else
directory = WScript.Arguments.Item(0)
fileName= WScript.Arguments.Item(1)
Set objShell = WScript.CreateObject("WScript.Shell")
command = "cmd /c dir /l /w " & directory & "*" &filename & "*.log"
Set oExec = objShell.Exec(Command)
Do While Not oExec.StdOut.AtEndOfStream
commandoutput = oExec.StdOut.ReadLine()
If Instr(commandoutput, ".log") > 0 then
replaced = replace(commandOutput,filename, directory & filename)
wscript.echo replaced
End if
Loop
End if


The next step is to deploy this script to your Managed Nodes, we may create new Instrumentation by creating a new folder under %ovdatadir%\shared\Instrumentation\Categories ,  lets name it LogFileMonitor


image


Browse to the Policy Group or to Policy Management –> Policies grouped by type-> Agent Policies –> Logfile Entry


image


In the Log file path type <`c:\windows\system32\cscript.exe /nolog listlog.vbs c:\Cisco\log\ cisco`>  but during the test it work with me as <`c:\windows\system32\cscript.exe /nologo "%ovdatadir%"\bin\instrumentation\listlogs.vbs c:\Cisco\log\ cisco`>


image


Save the policy, you may use Category option to automatically deploy the instrumentation with the policy (requires certain configuration)


image









Distribute the instrumentation,then deploy the policy to your managed nodes.


image




 


 


This was in response of HP Support forum question on ITRC Logfile Monitoring with File name changes after server reeboot

Friday, April 1, 2011

OMW: List log files to be monitored

 

In an answer to HP support forum about how to list files with certain extention to be used on OMW

We have a sample directory contain may different logs, we need to monitor only files start with cisco

image

Use dir /b /s will list the files only with their full path

image

to optimality integrate this with OMW

Create a log file monitor and under file to be executed type <`cmd.exe /c dir d:\cisco\log\cisco*.log /b /S`>

This will enabled the logfile policy to read all the files and will parse them for the policy rules

This was in respond to Logfile Monitoring with File name changes after server reeboot

OMW: Alert when files are older than 30 minutes Part 1

1- Create the needed script

This script is listing the files that are located in certain directory

cscript /nologo checkolderfiles.vbs abc c:\scripts list

I have added two features for the script

One is to display list the files which are not modified within the time specified

file1.txt
file2.txt
listfiles.vbs


Second is to use opcmon to with a count of files that are not modified before 30 minutes


cscript /nologo checkolderfiles.vbs abc c:\scripts alert

2-prepare the file for distribution


Create a folder name it filesmonitoring under <ovdatadir>\shared\Instrumentation\Categories


image


3-Create Measurement Threshold Monitoring Policy


Create Measurement Threshold Policy name it “monitoroldfiles”


Use Source Type as Program


type in the command area


cscript /nologo checkoldfiles.vbs abc c:\scripts alert

this to run the script to check for the files located in c:\scripts and will generate alert with opcmon policyname=<number of files>


Create a matching rule to send alert if the value is greater than 0 to match the value sent by opcmon  and generate the alert


Add automatic command to this alert to list down which policies are not changed within the time assigned.


The command should be


cscript /nologo checkoldfiles.vbs abc c:\scripts list

4-Deploy the the instrumentation for filemonitoring to the nodes where this policy will be used.


the full script is below and name it checkoldfiles.vbs


nodeName = "."
If Wscript.Arguments.Count <; 3 Then
wscript.echo "Usage cscript checkoldfiles.vbs ""PolicyName"" ""<Files direcotory>"" ""<Alert |List >"" "
wscript.echo "Ex: to send the count to the OM"
wscript.echo "cscript listfiles.vbs abc c:\scripts alert"
wscript.echo "Ex: to list the files"
wscript.echo "cscript listfiles.vbs abc c:\scripts list"
Else
policyname = WScript.Arguments.Item(0)
path= WScript.Arguments.Item(1)
action=WScript.Arguments.Item(2)

myPath = Split(path,":")
drive= myPath(0)
if right(myPath(1),1) <;> "\" then
directory = replace(myPath(1),"\","\\") &; "\\"
else
directory = replace(myPath(1),"\","\\")
end if
Set dateTime = CreateObject("WbemScripting.SWbemDateTime")
dateTime.SetVarDate( DateAdd("n",-5,now()))
Set objWMIService = GetObject("winmgmts:" _
&; "{impersonationLevel=impersonate}!\\" & nodeName & "\root\cimv2")
query = "Select * From CIM_DataFile Where Drive = '"&; drive &":' and Path = '"& directory &"' and LastModified < '" & dateTime.Value &"'"
Set colFiles = _
objWMIService.ExecQuery(query)
if action= "list" then
listfiles()
elseif action="alert" then
alert()
end if
end if
Function listfiles()
For Each objFile in colFiles
strNewFile = objFile.FileName &; "." & objFile.Extension
Wscript.Echo strNewFile
next
End function
function alert()
Set objShell = WScript.CreateObject("WScript.Shell")
command = "cmd /c ""%ovinstalldir%\bin\opcmon.exe"" " &; policyname & "=" & colFiles.Count
Wscript.Echo command
Set oExec = objShell.Exec(Command)
Wscript.Echo "The output of the command: " &; Command
Do While Not oExec.StdOut.AtEndOfStream
commandoutput = oExec.StdOut.ReadLine()
Wscript.Echo commandOutput
Loop
end function


 


Continue on part 2

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

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

OMW:Enable Automatic Instrumentation Deployment

 

In the same namespace where you enabled Policy Deployment allows you to control the Auto deployment of the instrumentation, this can be allowed thought

In the console tree, right-click Operations Manager
Configure –> Server

image
Select "Policy Management and Deployment"
Select "Enable Automatic Instrumentation Deployment" change the Value to True.

 

image

Whenever Deploy a policy, the system will check for a Property called Category assigned to the policy and it will try to find that category under %ovdatadir%\shared\Instrumentation\Categories  on the management server and deploy the related tools to that node.

Sample:

Database SPI policies has the category Database_Monitoring you can easily locate the attribute in the list view of the policies under the Policy Management Node in OMW Console or the Properties page of the policy

 

image

image

Once this policy is deploy the folder contents %ovdatadir%\shared\Instrumentation\Categories\Database_Discovery will be deployed to the node (you may have sub-folders if you want different files to be deployed based on the Operating System Types / Versions / OSbits)

image

This article is created in response to ITRC Question below

http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1473794

Wednesday, March 16, 2011

Script for creating nodes in OMW

Copy and paste the script below as createNodes.vbs
If Wscript.Arguments.Count < 1 Then
'Check that you spacified the nodes filename
wscript.echo "Usage cscript createNodes.vbs ""filename"" "
wscript.echo "Ex:"
wscript.echo "cscript createNodes.vbs ""c:\nodelist.txt"""
Else
Set args = WScript.Arguments
arg1 = WScript.Arguments.Item(0)

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 & " -ostype ""AIX"" -osversion ""5L 5.3"" -systemtype ""Power PC Family"" -osbits ""32"" -agent_bin_format ""PowerPC"" "
Set WshShell = CreateObject("WScript.Shell")
Set oExec = WshShell.Exec(Command)
Wscript.Echo "The output of the command: " & Command
Do While Not oExec.StdOut.AtEndOfStream
commandoutput = oExec.StdOut.ReadLine()
Wscript.Echo commandOutput
Loop
End Function


Create a text file for example nodes.txt


node1.mahmoudthoughts.com
node2.mahmoudthoughts.com
node3.mahmoudthoughts.com

 

To ensure the script will work in your OMW version, change the path for ovownodeutil.cmd  located on line 22


The sample script is for creating AIX nodes only


To create any nodes open the Node Properties for a node with the same version and get the values located in the system tab and modify line 22 as per the red marks.


image_thumb2


Run

cscript createNodes.vbs nodes.txt

Friday, March 4, 2011

Monitor Unix processes in HP OM

Monitor the processes by several ways.

1-Log File Monitor
Configure the policy with pre-processing enabled to execute your script that direct the output to a text file and based on pattern matching rules, fetch the number of the processes.

2-Threshold Monitoring Policy
Where you have to create Measurement Threshold monitoring to launch a script and send the number of process instances along with opcmona.

3-Use the OSSPI built-in monitoring script to reach your goal as stated in your original question.

1- Monitor process using log file policy

Create Log file monitor policy
Leave log file location as empty
Enabled pre-processing option and for the field of command to be executed put your script
ps -ef | grep processname | grep -v grep | wc -l > /tmp/processname
Type the /temp/processname on the file to be read field
Note: replace the "processname" with the process you are looking for.
Create rule to look for value 0 to send you alert and for <!0> to send you the process is working

2- Monitor process using Measurement Threshold policy


Create a Measurement Threshold policy and name it with the process name
Select program as source and type
"processmonitor.sh policyname processname"
Note: replace the policyname and process name to match the exact policy name and process name.

Create minimum rule if processes are less than 1 then alert to be generated to as process is down

 

Create the following script and distribute it to the nodes (best option to distribute it as instrumentation)

---------processmonitor.sh--------
opcmon=$OVINSTALLDIR/bin/opcmon
policy=$1
process=$2
count=$(ps -ef | grep $process | grep -v grep | wc -l)
$opcmon $policy=$count
----------------------------------

3- Monitor Process using OSSPI.

Ref: Unix OS SPI Admin Guide http://support.openview.hp.com/selfsolve/document/KM14827/binary/UNIXOS-SPI_a35_AdminRef_pdf Page 86

The answer to your original question:
In OSSPI process monitor there is two files used for this:
1st one is created automatically called procmon.cfg and is created by "OSSPI-AutoDiscovery" policy and it is called discovery application
You can modify this file to add more processes but I am not sure if it will be overwritten by the re-discovery
2nd file is called procmon_local.cfg this can be manually created and it will not be overwritten by re-discovery, that's why you see everybody using it.

The file syntax is typical to procmon.cfg; also check the admin guide for more details.
[Process]
/path/to/process *

Also you can add processes by tools available in the OSSPI Process Monitoring application group to edit the process monitor configuration file.


After you add your processes
You can create a copy of any OSSPI process monitor template like "OSSPI-cronproc" and give it a new name and ensure that the program name in this policy to replace policy name and process name to match your own "osspi_perl.sh osspi_procmon.pl OSSPI-cronproc cron" with "osspi_perl.sh osspi_procmon.pl PolicyName Processname"