Writing a new device template, issue with sysName

Hello

I am adding a new device type, ie Huawei iBMC (idem DRAC or iLO but for their servers). Works pretty well so far, but I face a very basic issue: The sysName is not populated correctly on this device :

RFC1213-MIB::sysName.0 = STRING: “iBMC”
HUAWEI-SERVER-IBMC-MIB::hostName.0 = STRING: “my_ibmc_name”

So I would need a way to tell libreNMS to use HUAWEI-SERVER-IBMC-MIB::hostName.0 instead of RFC1213-MIB::sysName.0.

How could I do ?

Thanx

This would need includes/polling/os.inc.php to allow setting a sysName value as well.:

if ($sysname != $device['sysName']) {
    $update_array['sysName'] = $sysname;
    log_event('sysName -> ' . $sysname, $device, 'system', 3);
}

Untested but try it. You then set $sysname in your new includes/polling/os/$os.inc.php file.

Hello @laf

After a quick test, it appears that includes/polling/core.inc.php is doing the job before includes/polling/os.inc.php has a chance to do it. And I get the name changed every 2 poller.php call:

  • 1st time, core is fine and does nothing to sysName, and then $os.inc.php corrects it to the specific OID
  • 2nd time, core is not OK and overrides it, and $os.inc.php does not see it with the condition “if ($sysname != $device[‘sysName’])”. Even if I change the condition in $os.inc.php, I would end up with 2 calls to log_events which would be dirty …

I would say that for the moment, there is no clean solution without touching core.inc.php.

Before I start digging deeper in that direction, do you have any plans to touch this part of the polling code ?

Bye

We have no plans to change the core and now that you’ve found that aspect I don’t think (personally) trying to hack something else in that supports alternative sysNames is a good idea - maybe be better to speak to your vendor…

héhé … if only … but I’m not sure about the vendor, and also our server team would probably not agree to try funny newer iBMC firmware just for a matter of snmp sysName …

I’ll try to see if there is a way to get a clean solution for this …

Thanx for feedback

Hi there,

Feedback : The case was opened at the vendor, and we at least have a workaround, before we get a proper solution.
Workaround is to snmpset the sysName, because it is internally handled but no GUI is available to do it for the moment.

Anyway, the PR is now in the box :

Bye
PipoCanaja

1 Like