Web and Unmanaged
cancel
Showing results for 
Search instead for 
Did you mean: 

HPE OfficeConnect Switch 1820 8G J9979A : get CPU and memory utilization from SNMP 1

 
SOLVED
Go to solution
---HMN---
Occasional Contributor

HPE OfficeConnect Switch 1820 8G J9979A : get CPU and memory utilization from SNMP 1

Hi!

I have a switch with model and version firmware: HPE OfficeConnect Switch 1820 8G J9979A, PT.02.05, Linux 3.6.5, U-Boot 2012.10-00116.

I get statistics on interfaces by snmp. How do I get the snmp load of cpu and memory usage from snmp? Via the web this information is available.

4 REPLIES 4
SantoshPG
HPE Pro

Re: HPE OfficeConnect Switch 1820 8G J9979A : get CPU and memory utilization from SNMP 1

Hi,

From the management and config guide of this switch.

Link :- http://h20564.www2.hpe.com/portal/site/hpsc/public/kb/docDisplay/?docId=c04622710

The switch supports the following MIB only.

The switch supports the following MIBs: • BRIDGE-MIB (IEEE 802.1Q) • LLDP-MIB (IEEE 802.3AB) • EtherLike-MIB • IF-MIB • RFC1213-MIB • RMON-MIB (RMON History as in v1) • Power Ethernet MIB (RFC3621), only on switches that support PoE+. (No SNMP information is available on configured PoE schedules.)

Thank you,
I am an HPE employee
-------------------------------------------------------------------------
Was the post useful? Click on Kudos Thumb below
---HMN---
Occasional Contributor
Solution

Re: HPE OfficeConnect Switch 1820 8G J9979A : get CPU and memory utilization from SNMP 1

Thank you for your information. I saw that mibs didn't have cpu and memory utilization. I was resolved this issue by script get data from web console.
Sorry for my bad English
VargasDoug
Occasional Visitor

Re: HPE OfficeConnect Switch 1820 8G J9979A : get CPU and memory utilization from SNMP 1

I'm having the same problem with the 1920s model, how would this script get data from web console?
---HMN---
Occasional Contributor

Re: HPE OfficeConnect Switch 1820 8G J9979A : get CPU and memory utilization from SNMP 1

This is my script to get CPU and Memory on web console. It's written by python language. So you must install it on your monitor server.

Please could you send me your email through a private message by clicking here . I will send file script to you.

Note:

My script use with 1820 model. I don't sure with 1920s, it can login web console with same url in script

Because the script use browser to get data, It's get more performance of your monitor server. If you have many switch 1920s, you will lost many RAM and CPU for it.

------------------------------------------------------------------------------------------------------------------------------------------

#!/usr/bin/env
import requests, json, sys
#import compago
#app = compago.Application()

session = requests.Session()
session.trust_env = False
url = "http://" + sys.argv[1]
urlLogin = "/htdocs/login/login.lua"
urlData = "/htdocs/pages/base/support.lsp"
urlLogout = "/htdocs/pages/main/logout.lsp"
username = sys.argv[3]
password = sys.argv[4]
#@app.command
def getCPU():
if login()==0:
print "login failed"
else:
responseData = login()
html = responseData.text
noFindCPUStr = html.find('id="cpu_util_prog_bar_val">')
noCPUStr = len('id="cpu_util_prog_bar_val">')
cpu = responseData.text[noFindCPUStr + noCPUStr:(noFindCPUStr + noCPUStr + 2)]
print cpu
logout()
#@app.command
def getMem():
if login()==0:
print "login failed"
else:
responseData = login()
html = responseData.text
noFindMEMStr = html.find('id="mem_util_prog_bar_val">')
noMEMStr = len('id="mem_util_prog_bar_val">')
memory = responseData.text[noFindMEMStr + noMEMStr:(noFindMEMStr + noMEMStr + 2)]
print memory
logout()
def login():

data = {'username':username,'password':password}
headers = {'Content-type': 'application/json', 'Accept': 'text/plain'}
responseLogin = session.post(url + urlLogin, data, headers)
#print responseLogin.status_code
if responseLogin.status_code == 200:
#Logincookies = responseLogin.cookies
#responseData = session.post(url + urlData, cookies = Logincookies)
responseData = session.post(url + urlData)
#html = responseData.text
#print html
return responseData
else:
return 0

def logout():
session.post(url + urlLogout)
#print logout.status_code
session.close()

if __name__ == "__main__":
#app.run()
if sys.argv[2] == "getCPU":
getCPU()
elif sys.argv[2] == "getMem":
getMem()
else:
print "Invalid argument! (script.py ip function)"