Network Management / (OpenView-NNM) Practitioners Forum

Collecting bgp data using shell script

Go to solution
Acclaimed Contributor.

Collecting bgp data using shell script

Hello All


Is it possible to collect following bgp Variables using shell script,


bgpPeerRemoteAddr  .

bgpPeerState   .

bgpPeerAdminStatus  .


Please help..

Micro Focus Expert

Re: Collecting bgp data using shell script

Hi Ramesh,


     Note that my example is for unix.  You can do the same thing with windows scripting.


     I do not have a Sarian (bgp) device but below is an example of something similar with a cisco device in my lab.  You can use nnmsnmpwalk.ovpl to collect the information you need. 


     In the following example, I want to check the status for a power supply.  The Management Information Base (MIB) variable I want to check is called ciscoEnvMonSupplyState and is part of a table called ciscoEnvMonSupplyStatusTable.  In order to determine the table name, I output a full nnmsnmpwalk.ovpl for the device to a file and found the variable I was looking for.  Why is this important?  An nnmsnmpwalk.ovpl can take minutes to run.  If you know which table contains the information you are looking for, you can increase performance by querying only that table.  Here is the table I want dumped from an nnmsnmpwalk.ovpl:


# $NNM_BIN/nnmsnmpwalk.ovpl ciscoEnvMonSupplyStatusTable

ciscoEnvMonSupplyStatusTable.ciscoEnvMonSupplyStatusEntry.ciscoEnvMonSupplyStatusDescr.1 : OCTET STRING- (ascii): AC Power Supply
ciscoEnvMonSupplyStatusTable.ciscoEnvMonSupplyStatusEntry.ciscoEnvMonSupplyState.1 : INTEGER: normal
ciscoEnvMonSupplyStatusTable.ciscoEnvMonSupplyStatusEntry.ciscoEnvMonSupplySource.1 : INTEGER: 2


Note that I have highlighted the table name in red and the variable name in blue.  Also note that the actual value for each variable is the third piece of the line using the colon (:) as a delimiter.


If you want to obtain the status of the AC Power Supply, the following script will pull that value:


--- begin script ---



# Script:  cisco_status - print value of ciscoEnvMonSupplyState


$NNM_BIN/nnmsnmpwalk.ovpl ciscoEnvMonSupplyStatusTable | grep ciscoEnvMonSupplyState | awk -F: '{print $3}'


--- end script ---


Here I run the script:


# ./cisco_status


You would likely want to print the device description and other information and you would want to format the output but this is a quick example of how to pull the information you want from the nnmsnmpwalk.ovpl using a script.



HP Support
If you find that this or any post resolves your issue, please be sure to mark it as an accepted solution, If you are satisfied with anyone’s response please remember to give them a KUDOS and show your appreciation.
Outstanding Contributor.

Re: Collecting bgp data using shell script

what if want to check for multi devices , what would be the script ! and got the as followign format as aresult


Device name   || Power Status || Power source



Mostafa hassan

All the best .
Mostafa Hassan
Acclaimed Contributor.

Re: Collecting bgp data using shell script

Dear Mostafa


Can you please elaborate on what do you mean?