Counting the total number of cable modems

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
dmircea
Posts: 5
Joined: Thu Dec 18, 2003 4:13 am
Location: Bucharest
Contact:

Counting the total number of cable modems

Post by dmircea »

I have added to the standard interface.xml some new fields:
<ifCmTotal>
<name>Total Modems</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.9.9.116.1.3.3.1.4</oid>
</ifCmTotal>
<ifCmRegistered>
<name>Registered Modems</name>
<method>walk</method>
<source>value</source>
<direction>output</direction>
<oid>.1.3.6.1.4.1.9.9.116.1.3.3.1.6</oid>
</ifCmRegistered>

I have created a new ubr10k_interface.xml and a new Data Query based on that.

I'm looking for a way to summarize the Total number of Cable modems on all interfaces.
I was thinking to add a CDEF but there are more that one .rrd and I have 35 interfaces. Can you suggest another way how can I do that?
dmircea
Posts: 5
Joined: Thu Dec 18, 2003 4:13 am
Location: Bucharest
Contact:

Post by dmircea »

I'm out of ideas. The only way to total these values that I found is to create an external script which will query the chassis and total the values... but that is pretty ugly.

There must be someone out there who has a cable network and is graphing the total number of cable modems on his boxes.
cgruber

Post by cgruber »

I think thats your only option... Collect the ouput of show cable modem summary total and then parse out the numbers you need and graph it.
cgruber
Posts: 4
Joined: Sun Aug 22, 2004 7:55 pm

Post by cgruber »

If your still looking for a script to do this I threw this together and use it to monitor my 25 CMTS's I maintain. It takes the ip address of the box as a parameter and then returns the percentage of modems online.

Then you just set it up as a datasource and graph it.

#!/usr/bin/php -q
<?PHP

$username = '';
$password = '';
$command = 'show cable modem summary total';
$Server = $_SERVER['argv'][1];


$Port = 23;
$TimeOut = 10;

$usenet = fsockopen($Server, $Port, &$errno, &$errstr, $TimeOut);

if(!$usenet)
{
echo "Connection failed\n";
exit();
}
else
{
fputs ($usenet, "$username\r\n");
fputs ($usenet, "$password\r\n");
fputs ($usenet, "$command\r\n");
fputs ($usenet, "exit\r\n");

while (!feof($usenet))
{ $buffer = "$buffer" . fgets($usenet, 128) . "\n"; }
fclose($usenet);

// Here's the fun parsing stuff.
preg_match("/Cable\d+/", $buffer, $matches);
$buffer = strstr($buffer, $matches[0]); // get rid of all the extra junk before$
$pos = strpos($buffer, 'ts');
$buffer = substr($buffer,0, $pos);
$pos = strpos($buffer, 'Total:');
$buffer = substr($buffer, $pos, strlen($buffer));
$buffer = preg_replace('/\s+/', ' ', $buffer); // Remove all extra spaces
$buffer = explode(" ", $buffer);

$total = $buffer[2]/$buffer[1];
$total = round($total,2);
$total = $total * 100;
echo $total;
}
?>
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests