Skip to content
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

feature: HPE Comware Processor Discovery #6029

Merged
merged 4 commits into from
Mar 1, 2017

Conversation

Rosiak
Copy link
Member

@Rosiak Rosiak commented Feb 27, 2017

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.

  • Have you signed the Contributors agreement - please do NOT submit a pull request unless you have (signing the agreement in the same pull request is fine). Your commit message for signing the agreement must appear as per the docs.
  • Have you followed our code guidelines?

Testers

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

@mention-bot
Copy link

Thank you for submitting a PR @Rosiak! We have found the following @laf and @FTBZ based on the history of these files to review this PR.

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://6029.ci.librenms.org or https://6029.ci.librenms.org

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://6029.ci.librenms.org or https://6029.ci.librenms.org

@murrant
Copy link
Member

murrant commented Mar 1, 2017

@Rosiak I was wondering if we could use the entPhysicalData from the database, soooo, I re-wrote this. Do you like this better?


if ($device['os'] == 'comware') {
    echo 'HPE Comware ';

    if (dbFetchCell('SELECT COUNT(`entPhysical_id`) FROM `entPhysical` WHERE `device_id` = ?', array($device['device_id']))) {
        $indexes = dbFetchColumn('SELECT `entPhysicalIndex` FROM `entPhysical` WHERE device_id = ? AND entPhysicalName = ?', array($device['device_id'], 'Board'));
    } else {
        $entity_data = snmpwalk_cache_oid($device, 'entPhysicalName', array(), 'ENTITY-MIB');
        $indexes = array_keys(array_filter($entity_data, function ($entry) {
            return $entry['entPhysicalName'] == 'Board';
        }));
    }

    if (!empty($indexes)) {
        $procdata = snmpwalk_cache_oid($device, 'hh3cEntityExtCpuUsage', array(), 'HH3C-ENTITY-EXT-MIB');

        foreach ($indexes as $i => $entIndex) {
            if (isset($procdata[$entIndex])) {
                $cur_oid = ".1.3.6.1.4.1.25506.2.6.1.1.1.1.6.$entIndex";
                $cur_value = $procdata[$entIndex]['hh3cEntityExtCpuUsage'];
                $descr = 'Slot ' . ++$i;
                discover_processor($valid['processor'], $device, $cur_oid, $entIndex, 'comware', $descr, '1', $cur_value);
            }
        }
    }
}

if ($index == $procindex) {
$cur_oid = '.1.3.6.1.4.1.25506.2.6.1.1.1.1.6.';

discover_processor($valid['processor'], $device, $cur_oid . $procindex, $procindex, 'comware', 'Slot ' . $x, '1', $value['h3cEntityExtCpuUsage']);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be hh3cEntityExtCpuUsage

@Rosiak
Copy link
Member Author

Rosiak commented Mar 1, 2017

Perfectly fine with that @murrant !

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://6029.ci.librenms.org or https://6029.ci.librenms.org

@laf
Copy link
Member

laf commented Mar 1, 2017

lol, I'm against that personally as per the other PR which did the same.

Doing it this way requires entity-physical discovery module to be enabled and have run before this (admittedly after the second run it won't matter if entity-physical runs first or not). However the dependancy on another module imho is a no no as you're restricting users who have sensors enabled because they want to see them but not entity-physical.

Other discovery modules which require entityphysical info do another walk afaik - which if we can get the updated snmp Class finished and merged won't be an issue as the results will be cached.

@murrant
Copy link
Member

murrant commented Mar 1, 2017

@laf I specifically made a fallback so this doesn't rely on the entity-physical module, only takes advantage of it if it exists.

@laf
Copy link
Member

laf commented Mar 1, 2017

Yeah I didn't realise that until you pointed it out as I'd only read the reply on email where it said you rewritten it to pull from DB.

As you pointed out in irc, this still does mean that someone could have stale data if entity-physical was disabled 6 months ago as an example. It's not a huge concern but does still swing me more to why bother checking the DB if we can't be sure when that data was from.

@LibreNMS-CI
Copy link

Auto-Deploy finished, Test PR at http://6029.ci.librenms.org or https://6029.ci.librenms.org

@scrutinizer-notifier
Copy link

The inspection completed: No new issues

@Rosiak
Copy link
Member Author

Rosiak commented Mar 1, 2017

As it's only disco job, I'm not concerned regarding the "extra" snmp req as this not that "expensive" at this point.

@murrant murrant merged commit 1f59322 into librenms:master Mar 1, 2017
@Rosiak Rosiak deleted the comware-processor branch November 15, 2017 18:02
@lock
Copy link

lock bot commented May 16, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed.

@lock lock bot locked as resolved and limited conversation to collaborators May 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants