cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1114
Views
0
Helpful
8
Replies

Cisco SG200-08 Memory Leak

davegrabo
Level 1
Level 1

I picked up a used SG200-08 recently and have added it to a small environment. I wrote a script to gather statistics by 'curl'ing through some of the administrative web pages (output in Nagios format) because the switch does not support SNMP.

 

I'm tracking the basic stuff - CPU, memory, and interface statistics.

 

Interestingly, the switch appears to have a memory leak, and I suspect that it's caused by the logins to the http server every five minutes. Looks like it's chewing up about 400kB/day.

sg200-08 memory leak.JPG

 

There's another post here (https://community.cisco.com/t5/small-business-switches/sg200-08-http-server-memory-leak/td-p/2598334) that noticed the same thing, with no resolution.

 

Is this a known issue? Is there any possibility that this will get fixed?

8 Replies 8

Deepak Kumar
VIP Alumni
VIP Alumni

Hi,

I am not much familiar with this version of the switch. My advice to book a ticket with TAC team.

 

Regards,

Deepak Kumar

 

Regards,
Deepak Kumar,
Don't forget to vote and accept the solution if this comment will help you!


@Deepak Kumar wrote:

Hi,

I am not much familiar with this version of the switch. My advice to book a ticket with TAC team.

 

Regards,

Deepak Kumar

 


Thanks for your reply, but that's not very helpful. Since I indicated that I picked up the switch *used*, there's no support contract, so I have no ability to open a TAC case.

Hi,
did you check the resources uses after stopping the script?

Regards,
Deepak Kumar
Regards,
Deepak Kumar,
Don't forget to vote and accept the solution if this comment will help you!


@Deepak Kumar wrote:
Hi,
did you check the resources uses after stopping the script?

Regards,
Deepak Kumar

Yes - if I stop the script, resources no longer decrease.

Currently, the script runs every five minutes. If I run the script constantly (it takes a few seconds to run), memory dwindles dramatically.

Hi,

What is Switch's firmware version? Try to upgrade the firmware.

 

Regards,

Deepak Kumar

 

Regards,
Deepak Kumar,
Don't forget to vote and accept the solution if this comment will help you!

It's running 1.0.8.3, the latest version.

benjaminr
Level 1
Level 1

@davegrabowould you share your curls or monitoring scripts with us?

To be clear... I gave up on the SG200, and replaced it with a cheap-on-ebay SG250. I simply didn't have the patience to deal with the SG200.

But, I did write a script that seemed to work. Have fun. (It didn't paste correctly with indents, but I think you can figure it out)

 

#! /bin/bash
# Obtain statistics for Cisco SG200 and output as standard Nagios plugin
# Grabo 2018-11-04; updated 2019-01-18
# usage: sg200.sh -d=[device] -u=[username] -p=[password]

#bail on any error
set -e

for i in "$@"
do
case $i in
-d=*)
device="${i#*=}"
shift
;;
-u=*)
username="${i#*=}"
shift
;;
-p=*)
passraw="${i#*=}"
shift
;;
*)
;;
esac
done

password=$(echo -n $passraw | base64) #need to convert password to base64

base=$(mktemp -u).sg200.$device #suitable temp file storage

#login and get cookies
curl -s -c $base.cookies -d "uname=$username&pwd2=$password" http://$device/nikola_login.html -o /dev/null

#bail if we didn't get cookies
if [ ! -f $base.cookies ]; then
exit 1
fi

#from this point forward, no error checking, fingers crossed

# basics - hostname and uptime
curl -s -b $base.cookies http://$device/SetupSystemSummary.html -o $base.summary

# hostname
output="sg200|hostname="$(grep NAME=v_1_5_1 $base.summary | cut -d '"' -f2)

# uptime
output+=" sysUpTime="$(grep v_1_2_2 $base.summary | cut -d '"' -f2 | awk '{print 100*($1*86400+$3*3600+$5*60+$7)}')

# cpu and memory
curl -s -b $base.cookies http://$device/DiagnosticsCPUUtilization.html -o $base.diag

# cpu 1min
output+=" cpu1min="$(grep -i v_1_5_1 $base.diag | cut -d '"' -f2)

# cpu 5min
output+=" cpu5min="$(grep -i v_1_6_1 $base.diag | cut -d '"' -f2)

# free mem
output+=" freemem="$(grep -i v_1_9_1 $base.diag | cut -d '"' -f2)

# alloc mem
output+=" allocmem="$(grep -i v_1_8_1 $base.diag | cut -d '"' -f2)

#interface stats
for i in 1 2 3 4 5 8
do

curl -s -b $base.cookies -d "v_1_23_1=g$i&submit_target=StatisticsInterface.html" http://$device/StatisticsInterface.html/a1 -o $base.g$i

output+=" g"$i"tx="$(grep v_1_12_1 $base.g$i | cut -d '"' -f2)
output+=" g"$i"rx="$(grep v_1_3_1 $base.g$i | cut -d '"' -f2)

done

echo $output

#logout
curl -s -b $base.cookies -d "language_selector_withAddOption=en-US&err_flag=0&err_msg=&mainpage=nikola_main.html&loginpage=nikola_login.html&submit_flag=8" http://$device/nikola_main.html -o /dev/null

rm -f $base.*