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?
Counting the total number of cable modems
Moderators: Developers, Moderators
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;
}
?>
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;
}
?>
Who is online
Users browsing this forum: No registered users and 1 guest