New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device: Improve Allied Telesis Chassis product support #8139

Merged
merged 22 commits into from Mar 15, 2018

Conversation

Projects
None yet
4 participants
@mattie47
Contributor

mattie47 commented Jan 23, 2018

Fix - Wrong Serial number was displayed
Enhancement - Show the type of Controller card in chassis

Controller card can be either CFC400, or CFC960.

Tests:

  • Checked Chassis x8106, and x8112
  • Checked with CFC400 and CFC960
    -- Checked behaviour with/without CFC in bay 1.5

DO NOT DELETE THIS TEXT

Please note

Please read this information carefully. You can run ./scripts/pre-commit.php to check your code before submitting.

Testers

If you would like to test this pull request then please run: ./scripts/github-apply <pr_id>, i.e ./scripts/github-apply 5926

device: Improve Allied Telesis Chassis product support
Fix - Wrong Serial number was displayed
Enhancement - Show the type of Controller card in chassis

Controller card can be either CFC400, or CFC960.

Tests:
- Checked Chassis x8106, and x8112
- Checked with CFC400 and CFC960
-- Checked behaviour with/without CFC in bay 1.5
@mattie47

This comment has been minimized.

Contributor

mattie47 commented Jan 23, 2018

@murrant

As per highlighted:

image

Is this the best way to specify a controller card in a chassis ?

As you can see, I used $feature, but I'm not sure if something better than this exists for specifying a chassis' controller card.

Thanks,

Matt

@mattie47

This comment has been minimized.

Contributor

mattie47 commented Jan 23, 2018

It does however look good when you see the list view:

image

if (strpos($hardware, 'SBx81') !== false) {
$hardware = snmp_get($device, "sysObjectID.0", "-OQvs", "SNMPv2-MIB:AT-PRODUCT-MIB");
$hardware = str_replace('at', '', $hardware);
$hardware = str_replace('at', 'AT-', $hardware);

This comment has been minimized.

@laf

laf Jan 24, 2018

Member

Is this not risking matching at anywhere in the hardware string? Would '/^at/' not be better?

This comment has been minimized.

@mattie47

mattie47 Jan 24, 2018

Contributor

Yeah good point.

This comment has been minimized.

@mattie47

mattie47 Jan 25, 2018

Contributor

I've spent a while on this and can't get something that will match.

'/^at/' doesn't seem to work for atSBx8106 or atSBx8112.

Unless you can give another suggestion, I really don't know what to try :-(

These are the only two options $hardware can be, and given that we only go down this path if SBx81 is true I guess this shouldn't be too concerning.

$hardware = str_replace('at', '', $hardware);
$hardware = str_replace('at', 'AT-', $hardware);
// Features and Serial is set to Controller card 1.5
$features = snmp_get($device, "rscBoardName.5.6", "-OQv", "AT-RESOURCE-MIB");

This comment has been minimized.

@laf

laf Jan 24, 2018

Member

No way to check sysObjectID or something we already know to determine the rcsBoardNames?

If not, you'll need to convert the two snmp_gets into snmp_get_multi_oid.

This comment has been minimized.

@mattie47

mattie47 Jan 24, 2018

Contributor

The problem is the device names suck in AT-PRODUCT-MIB.

Unless I'm doing something stupidly wrong, this is what returns when polling several different products:

MIB search path: /opt/librenms/mibs/:/opt/librenms/mibs/awplus
atsbx908g2 ----> Should be AT-SBx908-GEN2
librenms@librenmsdev:~$  snmpget -v2c -c librenms -OvQs -M /opt/librenms/mibs/:/opt/librenms/mibs/awplus 10.37.105.4 SNMPv2-MIB::sysObjectID.0
MIB search path: /opt/librenms/mibs/:/opt/librenms/mibs/awplus
atx93028GTX ----> Should be AT-x930-28GTX
librenms@librenmsdev:~$  snmpget -v2c -c librenms -OvQs -M /opt/librenms/mibs/:/opt/librenms/mibs/awplus 10.37.105.5 SNMPv2-MIB::sysObjectID.0
MIB search path: /opt/librenms/mibs/:/opt/librenms/mibs/awplus
atXS916MXT ----> Should be AT-XS916-MXT
librenms@librenmsdev:~$  snmpget -v2c -c librenms -OvQs -M /opt/librenms/mibs/:/opt/librenms/mibs/awplus 10.37.105.6 SNMPv2-MIB::sysObjectID.0
MIB search path: /opt/librenms/mibs/:/opt/librenms/mibs/awplus
Cannot find module (FCMGMT-MIB): At line 28 in /opt/librenms/mibs//SW-MIB
Did not find 'connUnitPortStatEntry' in module #-1 (/opt/librenms/mibs//SW-MIB)
atx510L28GT ----> Should be AT-x510-28GT
librenms@librenmsdev:~$  snmpget -v2c -c librenms -OvQs -M /opt/librenms/mibs/:/opt/librenms/mibs/awplus 10.37.105.7 SNMPv2-MIB::sysObjectID.0
MIB search path: /opt/librenms/mibs/:/opt/librenms/mibs/awplus
atGS948MPX ----> Should be AT-GS948-MPX

rscBoardName simply provides the more correct device name. It just so happens the SBx8112 and SBx8106 don't have any "dashes" then product type after the name so this worked OK for using AT-PRODUCT-MIB

This comment has been minimized.

@mattie47

mattie47 Jan 24, 2018

Contributor

If not, you'll need to convert the two snmp_gets into snmp_get_multi_oid.

And I should know this by now ;-)

@murrant

This comment has been minimized.

Member

murrant commented Jan 25, 2018

Can we combine these to a single snmp_getnext_multi() call?
You could probably call snmp_translate($device['sysObjectID'], 'AT-PRODUCT-MIB') instead of re-fetching sysObjectID.
Why is $hostname being set in this file?

@murrant

This comment has been minimized.

Member

murrant commented Jan 27, 2018

snmp_translate() changes #8156

@mattie47

This comment has been minimized.

Contributor

mattie47 commented Jan 28, 2018

@murrant - Thanks.

I've just tried using
$hardware = snmp_translate($device['sysObjectID'], 'AT-PRODUCT-MIB');

SNMP[/usr/bin/snmptranslate -M /opt/librenms/mibs:/opt/librenms/mibs/ -m AT-PRODUCT-MIB -Os .1.3.6.1.4.1.207.1.14.114 2>/dev/null]
iso.*.*.114

As per above, it's not appending the OS location to -M. E.g. should be:

SNMP[/usr/bin/snmptranslate -M /opt/librenms/mibs:/opt/librenms/mibs/awplus/ -m AT-PRODUCT-MIB -Os .1.3.6.1.4.1.207.1.14.114 2>/dev/null]
iso.*.*.114

I assume it should be?

Thanks,

Matt

@mattie47

This comment has been minimized.

Contributor

mattie47 commented Feb 13, 2018

Hi @murrant,

As per 6234949 I've updated my file however I still can't get the snmptranslate functionality working.

Please see https://p.libren.ms/view/4f7b6425 for what's happening.

Thanks,

Matt

@murrant

This comment has been minimized.

Member

murrant commented Feb 15, 2018

@mattie47 snmp_translate isn't working because it can't find the MIB. You need to provide a device or a mibdir. Try:

$hardware = snmp_translate($device['sysObjectID'], 'AT-PRODUCT-MIB', null, null, $device);
@mattie47

This comment has been minimized.

Contributor

mattie47 commented Feb 15, 2018

@murrant Thanks again. Tested both and that fixed things :-)

@laf

laf approved these changes Feb 15, 2018

@mattie47

This comment has been minimized.

Contributor

mattie47 commented Feb 20, 2018

Is there anything stopping this from being merged?

Thanks,

Matt

@murrant

This comment has been minimized.

Member

murrant commented Feb 22, 2018

Let me check the testing was ran against the new code. Then we can merge it.

@murrant

This comment has been minimized.

Member

murrant commented Feb 22, 2018

@mattie47 actually, I just looked again and I have a couple of changes to suggest.

Since you are now fetching multiple points of data from rscBoardName and rscBoardSerialNumber, a walk would be better and faster.

Also, can you add some test data for this?

@mattie47

This comment has been minimized.

Contributor

mattie47 commented Feb 24, 2018

Hi @murrant,

OK no worries.

Is something like this acceptable? Sorry if it's crap. I'm still very much learning PHP...

$data_array = snmpwalk_cache_multi_oid($device, 'rscBoardName', $data_array, 'AT-RESOURCE-MIB', '-OUsb');
$data_array = snmpwalk_cache_multi_oid($device, 'rscBoardSerialNumber', $data_array, 'AT-RESOURCE-MIB', '-OUsb');

d_echo($data_array);

if (strpos($hardware, 'SBx81') !== false) {
    $hardware = snmp_translate($device['sysObjectID'], 'AT-PRODUCT-MIB', null, null, $device);
    $hardware = str_replace('at', 'AT-', $hardware);
// Features and Serial is set to Controller card 1.5
    $features = $data_array['5.6']['rscBoardName'];
    $serial = $data_array['5.6']['rscBoardSerialNumber'];

It does work, but just not sure if it's the best way...

Thanks,

Matt

@laf

This comment has been minimized.

Member

laf commented Feb 27, 2018

@mattie47 No point in doing the walks if you don't use them, so add them after the if (strpos($hardware, 'SBx81') !== false) {

@mattie47

This comment has been minimized.

Contributor

mattie47 commented Feb 28, 2018

@murrant @laf OK this is finally done. Test data also updated. I also made it clear that the serial number shown if device is a chassis is the serial number of the controller card.

Thanks,

Matt

// Features and Serial is set to Controller card 1.5
$features = $data_array['5.6']['rscBoardName'];
$serial = $data_array['5.6']['rscBoardSerialNumber'];
$serial = $serial. ' - CFC Bay 1.5';

This comment has been minimized.

@laf

laf Mar 8, 2018

Member

Last one for me on this, why append something to the end of the serial? The serial field should solely contain the actual serial number.

This comment has been minimized.

@mattie47

mattie47 Mar 8, 2018

Contributor

@laf

No worries. I tried to answer this in my last comment, but to provide some more context.

Essentially, we could have up to 24 serial numbers for 24 line cards, with 4 cards being controller cards in a 2x 12 bay Chassis stack.

Then there's also the serial number for the chassis shell, and serials for the PSUs etc.

So as a user, I thought it was important to clarify what serial number we are actually reporting in LibreNMS.

I mean, as a user which serial should I also care about? In almost all cases - The Controller Card. This is because all licensing is tied to it.

So as a result, the serial number we most likely care about though is going to be either CFC Bay 1.5, or if not present then CFC Bay 1.6:

! Starting: Show system cmd 
! --------------------------------------------------------------------------------! 
! Stack member 1
! Board      ID   Bay     Board Name                        Rev   Serial number
! --------------------------------------------------------------------------------
! Chassis    374  Chassis AT-SBx8106                        B-0   R265E5008       
! Blade      353  Bay1    AT-SBx81XS6                       X8-0  A045624113500003
! Blade      317  Bay3    AT-SBx81GP24                      A-0   A04200a112800003
! Blade      352  Bay4    AT-SBx81GS24a                     C-1   A1XVD200E       
! Controller 376  Bay5    AT-SBx81CFC960                    B-0   A270E400A       
! Controller 376  Bay6    AT-SBx81CFC960                    B-0   A270E400U       
! PSU        319  PSUD    AT-SBxPWRSYS1/AC                  A-0   A045804135000064
! Fan module 375  FAN1    AT-SBxFAN06                       H-0   A04561A141900013
! --------------------------------------------------------------------------------
! --------------------------------------------------------------------------------
! Environment Status : Normal
! Bootloader version : 3.0.5
! Stack member 2
! Board      ID   Bay     Board Name                        Rev   Serial number
! --------------------------------------------------------------------------------
! Chassis    374  Chassis AT-SBx8106                        B-0   R265E3Z0L       
! Blade      381  Bay2    AT-SBx81XS16                      A-0   A04775H131100011
! Blade      380  Bay3    AT-SBx81GT40                      A-1   A26LD700Q       
! Controller 376  Bay5    AT-SBx81CFC960                    B-0   A270E400G       
! Controller 376  Bay6    AT-SBx81CFC960                    C-0   A270F602U       
! PSU        319  PSUD    AT-SBxPWRSYS1/AC                  A-0   A045804134300036
! Fan module 375  FAN1    AT-SBxFAN06                       H-0   A04561A141900010
! --------------------------------------------------------------------------------
! --------------------------------------------------------------------------------
! Environment Status : Normal
! Bootloader version : 3.0.2
! Current boot config: flash:/multi.cfg (file exists)
! System Name

Given the controller card can be in either bay 5 and/or 6, I felt it was worthwhile noting which controller card's serial number we're actually displaying in LibreNMS. It also makes it clear it's not the chassis shell's serial.

It's also worth noting I've only made this code run for this 1 product.

Thanks,

Matt

This comment has been minimized.

@mattie47

mattie47 Mar 8, 2018

Contributor

Also, if there's major concerns I'm adding this to the field, perhaps it's something I could look at removing when I finally get to #8109.

Since there's no entity mib support at the moment, which serial number we're showing for said chassis product just isn't clear. However, if the inventory support is in LibreNMS later, then the user of course can look at that tab to clarify further what serial number is in fact being displayed.

Since this isn't an option at the moment, I feel it's worth leaving the change as I currently have it.

Thoughts?

Thanks,

Matt

This comment has been minimized.

@laf

laf Mar 9, 2018

Member

Ok based on that I think you should remove the text. Their should be no reason to explain what serial number we display just that we pick the one that makes the most sense.

For example on the Cisco ASAs we use the Chassis serial number and I'm sure we do the same elsewhere so it makes more sense to use the chassis serial. The rest of them belong in inventory.

This comment has been minimized.

@mattie47

mattie47 Mar 12, 2018

Contributor

Ok based on that I think you should remove the text. Their should be no reason to explain what serial number we display just that we pick the one that makes the most sense.

OK no worries. Will change in next commit.

I'm sure we do the same elsewhere so it makes more sense to use the chassis serial.

Allied Telesis literally ties nothing licensing wise to the Chassis's serial. It's all tied to the controller card[s] in the chassis. Is that the same for Cisco ASAs? I'm assuming ASAs bind it to the Chassis...

I can make the serial the chassis' if you want...I guess I'm reluctant because I can't see any use in knowing the Chassis' serial number other than perhaps Inventory management of physical devices in a network.

Thanks,

Matt

This comment has been minimized.

@laf

laf Mar 13, 2018

Member

Use the one that makes the most sense :)

This comment has been minimized.

@mattie47

mattie47 Mar 13, 2018

Contributor

Done :-) Thanks.

@scrutinizer-notifier

This comment has been minimized.

scrutinizer-notifier commented Mar 13, 2018

The inspection completed: No new issues

@laf

laf approved these changes Mar 15, 2018

@laf

This comment has been minimized.

Member

laf commented Mar 15, 2018

Thanks as always @mattie47 :)

@laf laf added the Device 🖥 label Mar 15, 2018

@laf laf merged commit 0491e2e into librenms:master Mar 15, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
license/cla Contributor License Agreement is signed.
Details

inetAnt added a commit to criteo-forks/librenms that referenced this pull request Mar 19, 2018

device: Improve Allied Telesis Chassis product support (librenms#8139)
* device: Improve Allied Telesis Chassis product support

Fix - Wrong Serial number was displayed
Enhancement - Show the type of Controller card in chassis

Controller card can be either CFC400, or CFC960.

Tests:
- Checked Chassis x8106, and x8112
- Checked with CFC400 and CFC960
-- Checked behaviour with/without CFC in bay 1.5

* device: Update awplus to use snmp_get_multi_oid

* update awplus device support

* device: Fix awplus snmptranslate logic error

* device: awplus chassis support improvements

* device: update awplus test data

* device: fix awplus serial number info

* device: fix awplus test data

@mattie47 mattie47 deleted the mattie47:patch2 branch Apr 5, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Jun 5, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.