I've been getting some of our Enterasys switches working with Mactrack and there's a problem with the mactrack_strip_alpha function not removing all alpha characters from the ifType string. The Enterasys switch returns values like this:
rs232(33)
ieee8023adLag(161)
for serial ports and lag ports. mactrack_strip_alpha will return:
rs232(33
ieee8023adLag(161
for these. I've changed the function to this:
function mactrack_strip_alpha($string = "")
{
$matches;
if (preg_match('/^.*\((\d+)\)$/', $string, $matches) == 1)
{
return $matches[1];
}
}
which correctly returns:
33
161
for these ifTypes. This might be useful to someone.
[TODO] mactrack_strip_alpha function not working correctly
Moderators: Developers, Moderators
- TheWitness
- Developer
- Posts: 17047
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
That's a net-snmp configuration change. You are getting the full type, when you should be getting the numerical value only. Which SNMP are you using php-snmp or net-snmp?
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
I'm using the functions in mactrack_functions.php. I put in lots of print statements to the mactrack_enterasys.php script to help understand it better and it looks like when it retrieves the ifTypes it gets the text value and numerical values. Like this:
rs232(33)
mactrack_strip_alpha just calls trim which doesn't return 33 in this case which I would expect it to do. I think it's because there are digits in the part outside the brackets.
rs232(33)
mactrack_strip_alpha just calls trim which doesn't return 33 in this case which I would expect it to do. I think it's because there are digits in the part outside the brackets.
- TheWitness
- Developer
- Posts: 17047
- Joined: Tue May 14, 2002 5:08 pm
- Location: MI, USA
- Contact:
I guess the fix would be to make strip alpha have two methods, one that removes non-numeric data and one that removes everything except what's inside of the brackets.
TheWitness
TheWitness
True understanding begins only when we realize how little we truly understand...
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Life is an adventure, let yours begin with Cacti!
Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages
For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
Who is online
Users browsing this forum: No registered users and 0 guests