Cisco Router Bandwidth

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).

Moderators: administrator, KS-Soft

Post Reply
samplejs
Posts: 7
Joined: Tue Apr 30, 2002 6:00 pm
Location: samplejs
Contact:

Cisco Router Bandwidth

Post by samplejs »

I have read all of the other posts about using SNMP tests for Cisco routers and have almost everything I need.

I am still stuck on trying to figure out how to get a view of Bytes/Sec from the router though. The only OID's I see are for Packets in and out and Octets in and out. Am I just missing a simple conversion or is there some other OID's that my walk is not showing.

Thanks,
James
timn
Posts: 184
Joined: Thu Nov 20, 2003 9:57 am
Location: United States

Post by timn »

While we use AHM to monitor router basics (interface up?, errors?), we use MRTG for monitoring bandwidth utilization on both Cisco routers and Cisco PIX.

I believe MRTG is retrieving "octets in, octets out" from each interface, then calculating bandwidth rates base on these values.

MRTG is a bit of a standard and generates nice graphs. While written for UNIX boxes there is a Windows version that works great. Tobias provides a huge number of links to help resources.

We're a fairly small company but we recently implemented dual DS3 lines w/BGP from separate ISPs (i.e. multi-homed). Since true 'load balancing' is not directly supported in BGP, we configure our primary gateway router to perform outbound 'load sharing' - based on source network address(i.e. using route maps). This is a bit of a pain because you first have to figure out how to divide outbound packets 'evenly'. The short of this is that MRTG is great at letting us know when we've gotten our 'formula' right.

Oh, and it's free.
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

SNMP test has "increases /sec" option. If you set this option for "octets in" parameter, HostMonitor will display incoming traffic (octents / sec). You can use the same option for "octets out" counter.
Unfortunatelly HostMonitor cannot display sum of 2 different counters (octets in + octets out).

Regards
Alex
timn
Posts: 184
Joined: Thu Nov 20, 2003 9:57 am
Location: United States

Post by timn »

I've thought it might be nice if I could duplicate a small bit of the MRTG functionality in AHM. For example:

Code: Select all

Max  In: 2462.8 kb/s (5.6%)   Average  In: 325.2 kb/s (0.7%)   Current  In: 1174.2 kb/s (2.7%)  
Max  Out: 3825.2 kb/s (8.7%)   Average  Out: 1796.2 kb/s (4.1%)   Current  Out: 2467.7 kb/s (5.6%)  
Then alert if bandwidth approached, say 90% of maximum possible utilization. Trouble is, I'm not sure just exactly what I'd do to fix it (if this was the result of legitimate traffic). My supervisor might not be to happy if I told him "our routers are too busy, I'm going to shut them off for an hour or two..."

Might be useful for detecting dDOS attacks but then again, in either case, so many other things would be going wrong, I'd have a hard time missing it.

I would think that it would be possible to write a fairly simply piece of software that allowed you to 'glue' MRTG output to AHM for the purpose of alerting when bandwidth (or anything monitored by MRTG - over 5 minute average) exceeds a desired value. The cleanest way might be to access the MRTG .log files directly with a script.
samplejs
Posts: 7
Joined: Tue Apr 30, 2002 6:00 pm
Location: samplejs
Contact:

Post by samplejs »

Alex:

Octets in and octets out per second would be just fine... I can add the two together using a SQL query, since I am logging to a SQL server. But is there a way to convert from Octets to Bytes so that my report is in Bytes or KBytes per seconds?

Once I figure out that conversion it would be easy to write a SQL query to give me the same info that MRTG is providing.

Timn: Thanks for the Info I had looked at MRTG in the past but since I thought it only graphed the data. All I want are average and peak usage for a defined period of time. For example I have a frame circuit that shows 30% average usage, but if you shorten the time period to Business hours only, it jumps to 82%.

Thanks,
James
iis5_rulez
Posts: 32
Joined: Tue Dec 17, 2002 6:00 pm

Post by iis5_rulez »

i believe an octet is 3 bits. byte is 8. u can do the math ^^
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Actually octet is 8 bits == byte.

http://community.roxen.com/developers/i ... c1392.html
octet
An octet is 8 bits. This term is used in networking, rather than
byte, because some systems have bytes that are not 8 bits long.
Regards
Alex
KS-Soft
Posts: 12821
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

Timm,
I would think that it would be possible to write a fairly simply piece of software that allowed you to 'glue' MRTG output to AHM for the purpose of alerting when bandwidth (or anything monitored by MRTG - over 5 minute average) exceeds a desired value. The cleanest way might be to access the MRTG .log files directly with a script.
Or probably better implement (in HM) some script language that will be able to retrive SNMP counters and perform simple operations: +, -, *, /
?

Regards
Alex
iis5_rulez
Posts: 32
Joined: Tue Dec 17, 2002 6:00 pm

Post by iis5_rulez »

KS-Soft wrote:Actually octet is 8 bits == byte.

http://community.roxen.com/developers/i ... c1392.html
octet
An octet is 8 bits. This term is used in networking, rather than
byte, because some systems have bytes that are not 8 bits long.
Regards
Alex
lol yeah that makes sense... guess i was confused by octal maths (opposed to hexadecimal or binary)
samplejs
Posts: 7
Joined: Tue Apr 30, 2002 6:00 pm
Location: samplejs
Contact:

Post by samplejs »

Thank you so much for the help...It will be easy now to write the SQL queries to give me the info I need.

James
timn
Posts: 184
Joined: Thu Nov 20, 2003 9:57 am
Location: United States

Post by timn »

James:

Interesting. Are you saying you will accomplish this by having HM log the replies to a DB, then query the db to determin bandwidth?

I would be interested in how that turns out.

I've used the same approach to display the total number of users on a web farm.
timn
Posts: 184
Joined: Thu Nov 20, 2003 9:57 am
Location: United States

Post by timn »

(cross posted from thread "Monitoring PIX interfaces using SNMP")

Looks like I may be wrong WITH RESPECT TO CISCO ROUTERS on both the Interface and CPU utilization issue. I've just discovered:

OID_Variable Type Value

1.3.6.1.4.1.9.2.1.56.0 busyPer INTEGER

- CPU busy percentage in the last 5 second period. Not the last 5 realtime seconds but the last 5 second period in the scheduler.


1.3.6.1.4.1.9.2.1.57.0 avgBusy1 INTEGER

- 1 minute exponentially-decayed moving average of the CPU busy percentage.

1.3.6.1.4.1.9.2.1.58.0 avgBusy5 INTEGER

- 5 minute exponentially-decayed moving average of the CPU busy percentage.


For bits/sec see:

OID Variable Type Value
1.3.6.1.4.1.9.2.2.1.1.8.1 locIfOutBitsSec INTEGER
1.3.6.1.4.1.9.2.2.1.1.8.2 locIfOutBitsSec INTEGER
.... (increments with each interface)

OID Variable Type Value
1.3.6.1.4.1.9.2.2.1.1.6.1 locIfInBitsSec INTEGER
1.3.6.1.4.1.9.2.2.1.1.6.2 locIfInBitsSec INTEGER
.... (increments with each interface)

Described as:

Five minute exponentially-decayed moving
average of input bits per second.
Jax
Posts: 13
Joined: Mon Jan 12, 2004 7:38 pm

Post by Jax »

I use a script launched from HM to check the bandwidth on interfaces, this works for Cisco,Novell,Windows,Unix systems.

There is certain small issues with the Scripts that Alex is looking at but it does work.


const statusAlive = "Host is alive:"
const statusDead = "No answer:"
const statusUnknown = "Unknown:"
const statusNotResolved = "Unknown host:"
const statusOk = "Ok:"
const statusBad = "Bad:"
const statusBadContents = "Bad contents:"

' Checks the bandwidth used on an interface via SNMP
' The hostname or IP must be added in CommentLine1 of the test
' The oid must be added in CommentLine2 of the test
' Sample oid for IN Bytes on Interface 1 oid = ".1.3.6.1.2.1.2.2.1.10.1"
' Sample oid for OUT Bytes on Interface 1 oid = ".1.3.6.1.2.1.2.2.1.16.1"
' The sample period is about 2 seconds, the longer the more accurate

' Due to some misfunctionality that will be fixed in the future were we cant use WScript.sleep
' for the delay and instead we call and exteral VB script (delay.vbs) for the delay
' delay.vbs only contains one line "Wscript.sleep(2000)"


FUNCTION PerformTest()

target = "%CommentLine1%"
community = "public"
oid = "%CommentLine2%"
prog = "snmpget.exe"

snmpcmd = prog & " " & target & " " & community & " " & oid

'Get first value of counter
Set WshShell = CreateObject("WScript.Shell")
set oExec = WshShell.Exec(snmpcmd)
sStdout1 = oExec.StdOut.ReadAll

' Start to count the elapsed time
StartTime = Timer

'call external delay 2 sec
Set WshShell = CreateObject("WScript.Shell")
set oExec = WshShell.Exec("cscript.exe c:\progra~1\hostmonitor4\scripts\Delay.vbs")
Dummy = oExec.StdOut.ReadAll

'Get second value of counter
Set WshShell = CreateObject("WScript.Shell")
set oExec = WshShell.Exec(snmpcmd)
sStdout2 = oExec.StdOut.ReadAll

'Get the elasped time
EndTime = Timer
ElapsedTime = EndTime - StartTime

' Check if the 32 Bit counter cycled and if so we fix it to a wrong value but not a negative value
If sStdout1 > sStdout2 then
sStdout1 = 1
End If

' Calculate the Bandwidth in KBytes/Sec
TrfRate = cStr(Round(((sStdout2 - sStdout1)/ElapsedTime/1000),2)) & " Kb/Sec"
status = statusOk

'Return the Bandwidth
PerformTest = status+TrfRate 'return the Status and Value to HM

END FUNCTION
Post Reply