Sunday, January 30, 2011

List all nodes from OMU server using opcnodes

By default OMU-L have a utility to control node management called opcnode it is similar to ovonodeutil.bat in OMW

You can use this tool to list all nodes like

/opt/OV/bin/OpC/utils/opcnode -list_nodes

image

But, in one of ITRC questions the Question Author request to get only the node name which falls under certain OS type

I made some trials and I would like to share them with you:

1st using shell script and opcmon command itself.

 

1: if [ $# -eq 0 ] ; then 
2:  echo "Use $0 <windows or unix>"  
3:  echo "To list windows nodes: $0 windows" 
4:  echo "To list Unix nodes: $0 unix" 
5:  exit
6: fi
7: 
<-- more -->
8: windows=( "MACH_BBC_WIN2K3_X64" "MACH_BBC_WINXP_IPF64" "MACH_BBC_WINNT_X86" )
9: unix=( "MACH_BBC_SOL_SPARC" "MACH_BBC_HPUX_IPF32" "MACH_BBC_HPUX_PA_RISC" "MACH_BBC_LX26RPM_X64" "MACH_BBC_LX26RPM_X86" "MACH_BBC_LX26RPM_IPF64" "MACH_BBC_SOL10_X86" "MACH_BBC_AIX_PPC" "MACH_BBC_AIX_K64_PPC")
10: 
11: if [ $1 = "windows" ]; then
12:  for i in ${windows[@]}
13:  do
14:   /opt/OV/bin/OpC/utils/opcnode -list_nodes mach_type=$i |grep "Name"
15:  done
16: 
17: elif [ $1 == "unix" ];  then
18:  for i in ${unix[@]}
19:  do
20:   /opt/OV/bin/OpC/utils/opcnode -list_nodes mach_type=$i |grep "Name"
21:  done
22: fi
23: 


usage  of the command listnodes.sh < unix or windows>



---sample usage---



[root@oml ~]# listnodes.sh
Use ./listnodes.sh <windows or unix>
To list windows nodes: ./listnodes.sh windows
To list Unix nodes: ./listnodes.sh unix




[root@oml ~]# listnodes.sh windows
Name         = mahmoud-pc.mahmoudthoughts.com




[root@oml ~]# listnodes.sh unix
Name         = oml.mahmoudthoughts.com




[root@oml ~]# listnodes.sh windows |awk '{print $3}'
mahmoud-pc.mahmoudthoughts.com




[root@oml ~]# listnodes.sh unix |awk '{print $3}'
oml.mahmoudthoughts.com
[root@oml ~]#
--------------------



For more information read full thread :http://forums11.itrc.hp.com/service/forums/questionanswer.do?threadId=1463140

Wednesday, January 19, 2011

Get Network Utilization Using VBs script

Last week I have faced challenge in responding to HP support (ITRC) thread regarding collecting Network utilization for Operation Manger to evaluate it against threshold.

Infrastructure SPI contain some policies for Monitoring network utilization but it is quite complicated (but efficient) as it has various  mathematical calculations.

Any way the script I have provided was just for calculating the utilization based on two factors total bytes transferred per second and the bandwidth.

We can get this data using WMI through "Win32_PerfFormattedData_TCPIP_NetworkInterface" class located on namespace "root\CIMV2"
We can use the attributes below to match factors stated above:

BytesTotalPersec
CurrentBandwidth

Network utilization calculation:
BytesTotalPerSec / CurrentBandwidth * 100


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\Root\CIMV2")
Set colItems = objWMIService.ExecQuery _
("select * from Win32_PerfFormattedData_TCPIP_NetworkInterface ")
For Each objItem in colItems
bytesTotal = objitem.BytesTotalPersec * 8
bandwidth = objItem.CurrentBandwidth
result = FormatNumber(( bytesTotal / bandwidth) * 100)
output = objitem.Name & " Network Bandwidth: " & result & " % Utilized"
WScript.Echo output
Next


Screenshot of the output.



networkutilization



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