SMART applications is not discovered on Ubuntu

Hi,

I have an issue setting up SMART applications on my Ubuntu nodes.
On Ubuntu, snmpd run as Debian-snmp, so it is needed to add /usr/bin/sudo at the start of the extend command.
Although it looks like doing this, something else break.

Case 1 : I don’t put sudo

Extend:

# /etc/snmp/snmpd.conf.d/librenms.conf
# [...]
extend smart /etc/snmp/smart

Walk:

$ snmpwalk -v 2c -c librenmssecure 192.168.20.2 NET-SNMP-EXTEND-MIB::nsExtendObjects | grep -v distro
NET-SNMP-EXTEND-MIB::nsExtendNumEntries.0 = INTEGER: 2
NET-SNMP-EXTEND-MIB::nsExtendCommand."smart" = STRING: /etc/snmp/smart
NET-SNMP-EXTEND-MIB::nsExtendArgs."smart" = STRING: 
NET-SNMP-EXTEND-MIB::nsExtendInput."smart" = STRING: 
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."smart" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendExecType."smart" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."smart" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendStorage."smart" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStatus."smart" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."smart" = STRING: {"data":{"disks":{},"exit_nonzero":2,"unhealthy":0,"useSN":"1"},"error":0,"errorString":"","version":1}
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."smart" = STRING: {"data":{"disks":{},"exit_nonzero":2,"unhealthy":0,"useSN":"1"},"error":0,"errorString":"","version":1}
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."smart" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendResult."smart" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."smart".1 = STRING: {"data":{"disks":{},"exit_nonzero":2,"unhealthy":0,"useSN":"1"},"error":0,"errorString":"","version":1}

Discovery:

$ ./discovery.php -h 192.168.20.2 -d -m applications

[...]

#### Load disco module applications ####

Applications: SNMP['/usr/bin/snmpbulkwalk' '-v2c' '-c' 'COMMUNITY' '-OQUs' '-m' 'NET-SNMP-EXTEND-MIB' '-M' '/opt/librenms/mibs' 'udp:HOSTNAME:161' 'nsExtendStatus']
nsExtendStatus."smart" = active
nsExtendStatus."distro" = active  
  

Available: apache, asterisk, backupninja, bind, bird2, cape, ceph, certificate, chronyd, dhcp-stats, docker, drbd, entropy, exim-stats, fail2ban, fbsd-nfs-client, fbsd-nfs-server, freeradius, freeswitch, gpsd, hv-monitor, icecast, linux_config_files, linux_softnet_stat, logsize, mailcow-postfix, mailscanner, mdadm, memcached, mojo_cape_submit, mysql, nfs-server, nfs-stats, nfs-v3-stats, nginx, ntp-client, ntp-server, nvidia, opengridscheduler, opensearch, opensips, os-updates, php-fpm, pi-hole, portactivity, postfix, postgres, powerdns-dnsdist, powerdns-recursor, powerdns, powermon, privoxy, proxmox, puppet-agent, pureftpd, pwrstatd, redis, rrdcached, sagan, sdfsinfo, seafile, shoutcast, smart, sneck, squid, ss, supervisord, suricata, suricata_extract, systemd, tinydns, unbound, ups-apcups, ups-nut, voip-monitor, wireguard, zfs, dhcpstats, fbsdnfsclient, fbsdnfsserver, mailq, osupdate, phpfpmsp, postfixdetailed, suricata-stats, sagan-stats  
Checking for: smart, distro  
SQL[SELECT `app_type`,`discovered` FROM `applications` WHERE `device_id`=? AND deleted_at IS NULL ORDER BY `app_type` [29] 0.62ms] 
  
SQL[select * from `applications` where `applications`.`device_id` = ? and `applications`.`device_id` is not null and 0 = 1 and `applications`.`deleted_at` is null [29] 0.43ms] 
  
SQL[DELETE T FROM `application_metrics` T LEFT JOIN `applications` ON `applications`.`app_id` = T.`app_id` WHERE `applications`.`app_id` IS NULL [] 0.61ms] 
  


>> Runtime for discovery module 'applications': 0.1080 seconds with 76568 bytes
>> SNMP: [1/0.10s] MySQL: [3/0.02s] RRD: [0/0.00s]  
#### Unload disco module applications ####

[...]

Polling

$ lnms device:poll 192.168.20.2 -m applications

[...]

#### Load poller module applications ####
  
Application: smart, app_id=3: ......

  
>> SNMP: [1/0.10s] MySQL: [3/0.02s] RRD: [2/0.00s]  
>> Runtime for poller module 'applications': 0.1082 seconds with 84992 bytes  
#### Unload poller module applications ####

[...]

So we can see it is correctly discovered, although I cannot get the values because the script has no permissions.

Case 2 : I do put sudo

Extend:

# /etc/snmp/snmpd.conf.d/librenms.conf
# [...]
extend smart /usr/bin/sudo /etc/snmp/smart

Walk:

$ snmpwalk -v 2c -c librenmssecure 192.168.20.3 NET-SNMP-EXTEND-MIB::nsExtendObjects | grep -v distro
NET-SNMP-EXTEND-MIB::nsExtendNumEntries.0 = INTEGER: 2
NET-SNMP-EXTEND-MIB::nsExtendCommand."smart" = STRING: /usr/bin/sudo
NET-SNMP-EXTEND-MIB::nsExtendArgs."smart" = STRING: /etc/snmp/smart
NET-SNMP-EXTEND-MIB::nsExtendInput."smart" = STRING: 
NET-SNMP-EXTEND-MIB::nsExtendCacheTime."smart" = INTEGER: 5
NET-SNMP-EXTEND-MIB::nsExtendExecType."smart" = INTEGER: exec(1)
NET-SNMP-EXTEND-MIB::nsExtendRunType."smart" = INTEGER: run-on-read(1)
NET-SNMP-EXTEND-MIB::nsExtendStorage."smart" = INTEGER: permanent(4)
NET-SNMP-EXTEND-MIB::nsExtendStatus."smart" = INTEGER: active(1)
NET-SNMP-EXTEND-MIB::nsExtendOutput1Line."smart" = STRING: {"data":{"disks":{"xxxxxx":{"10":"null","173":"null","177":"null","183":"0","184":"0","187":"0","188":"null","190":"24","194":24,"196":"null","197":"0","198":"null","199":"0","231":"null","232":100,"233":100,"5":"0","9":"26688","completed":0,"conveyance":0,"device_model":"INTEL SSDSC2KB019T8","disk":"sda","exit":0,"extended":0,"fw_version":"XCV10165","health_pass":1,"interrupted":0,"max_temp":24,"model_family":"Intel S4510/S4610/S4500/S4600 Series SSDs","offline":0,"read_failure":0,"selective":0,"selftest_log":null,"serial":"xxxxxx","short":0,"unknown_failure":0},"xxxxx":{"10":"null","173":"null","177":"null","183":"0","184":"0","187":"0","188":"null","190":"26","194":26,"196":"null","197":"0","198":"null","199":"0","231":"null","232":100,"233":99,"5":"0","9":"26688","completed":0,"conveyance":0,"device_model":"INTEL SSDSC2KB019T8","disk":"sdb","exit":0,"extended":0,"fw_version":"XCV10165","health_pass":1,"interrupted":0,"max_temp":26,"model_family":"Intel S4510/S4610/S4500/S4600 Series SSDs","offline":0,"read_failure":0,"selective":0,"selftest_log":null,"serial":"xxxxxx","short":0,"unknown_failure":0}},"exit_nonzero":0,"unhealthy":0,"useSN":"1"},"error":0,"errorString":"","version":1}
NET-SNMP-EXTEND-MIB::nsExtendOutputFull."smart" = STRING: {"data":{"disks":{"xxxxxx":{"10":"null","173":"null","177":"null","183":"0","184":"0","187":"0","188":"null","190":"24","194":24,"196":"null","197":"0","198":"null","199":"0","231":"null","232":100,"233":100,"5":"0","9":"26688","completed":0,"conveyance":0,"device_model":"INTEL SSDSC2KB019T8","disk":"sda","exit":0,"extended":0,"fw_version":"XCV10165","health_pass":1,"interrupted":0,"max_temp":24,"model_family":"Intel S4510/S4610/S4500/S4600 Series SSDs","offline":0,"read_failure":0,"selective":0,"selftest_log":null,"serial":"xxxxxx","short":0,"unknown_failure":0},"xxxxx":{"10":"null","173":"null","177":"null","183":"0","184":"0","187":"0","188":"null","190":"26","194":26,"196":"null","197":"0","198":"null","199":"0","231":"null","232":100,"233":99,"5":"0","9":"26688","completed":0,"conveyance":0,"device_model":"INTEL xxxxxx","disk":"sdb","exit":0,"extended":0,"fw_version":"XCV10165","health_pass":1,"interrupted":0,"max_temp":26,"model_family":"Intel S4510/S4610/S4500/S4600 Series SSDs","offline":0,"read_failure":0,"selective":0,"selftest_log":null,"serial":"xxxxxx","short":0,"unknown_failure":0}},"exit_nonzero":0,"unhealthy":0,"useSN":"1"},"error":0,"errorString":"","version":1}
NET-SNMP-EXTEND-MIB::nsExtendOutNumLines."smart" = INTEGER: 1
NET-SNMP-EXTEND-MIB::nsExtendResult."smart" = INTEGER: 0
NET-SNMP-EXTEND-MIB::nsExtendOutLine."smart".1 = STRING: {"data":{"disks":{"xxxxxx":{"10":"null","173":"null","177":"null","183":"0","184":"0","187":"0","188":"null","190":"24","194":24,"196":"null","197":"0","198":"null","199":"0","231":"null","232":100,"233":100,"5":"0","9":"26688","completed":0,"conveyance":0,"device_model":"INTEL SSDSC2KB019T8","disk":"sda","exit":0,"extended":0,"fw_version":"XCV10165","health_pass":1,"interrupted":0,"max_temp":24,"model_family":"Intel S4510/S4610/S4500/S4600 Series SSDs","offline":0,"read_failure":0,"selective":0,"selftest_log":null,"serial":"xxxxxx","short":0,"unknown_failure":0},"xxxxx":{"10":"null","173":"null","177":"null","183":"0","184":"0","187":"0","188":"null","190":"26","194":26,"196":"null","197":"0","198":"null","199":"0","231":"null","232":100,"233":99,"5":"0","9":"26688","completed":0,"conveyance":0,"device_model":"INTEL xxxxxx","disk":"sdb","exit":0,"extended":0,"fw_version":"XCV10165","health_pass":1,"interrupted":0,"max_temp":26,"model_family":"Intel S4510/S4610/S4500/S4600 Series SSDs","offline":0,"read_failure":0,"selective":0,"selftest_log":null,"serial":"xxxxxx","short":0,"unknown_failure":0}},"exit_nonzero":0,"unhealthy":0,"useSN":"1"},"error":0,"errorString":"","version":1}

Discovery:

$ ./discovery.php -h 192.168.20.3 -d -m applications
#### Load disco module applications ####

Applications: SNMP['/usr/bin/snmpbulkwalk' '-v2c' '-c' 'COMMUNITY' '-OQUs' '-m' 'NET-SNMP-EXTEND-MIB' '-M' '/opt/librenms/mibs' 'udp:HOSTNAME:161' 'nsExtendStatus']
Exitcode: 1  
Timeout: No Response from udp:192.168.20.3:161  
  
Timeout: No Response from udp:192.168.20.3:161  

Available:  
Checking for:  
SQL[SELECT `app_type`,`discovered` FROM `applications` WHERE `device_id`=? AND deleted_at IS NULL ORDER BY `app_type` [65] 0.84ms] 
  
SQL[select * from `applications` where `applications`.`device_id` = ? and `applications`.`device_id` is not null and 0 = 1 and `applications`.`deleted_at` is null [65] 0.37ms] 
  
SQL[DELETE T FROM `application_metrics` T LEFT JOIN `applications` ON `applications`.`app_id` = T.`app_id` WHERE `applications`.`app_id` IS NULL [] 0.51ms] 
  


>> Runtime for discovery module 'applications': 6.0280 seconds with 75672 bytes
>> SNMP: [1/6.02s] MySQL: [3/0.02s] RRD: [0/0.00s]  
#### Unload disco module applications ####
lnms device:poll 192.168.20.3 -m applications
#### Load poller module applications ####
  
  
>> SNMP: [0/0.00s] MySQL: [1/0.01s] RRD: [2/0.00s]  
>> Runtime for poller module 'applications': 0.0070 seconds with 76064 bytes  
#### Unload poller module applications ####

So we can see the discovery fails, and so no polling is done on this application.
Although, if I enable the SMART app in the GUI for this device and rerun the polling, I get:

#### Load poller module applications ####
  
Application: smart, app_id=4: ..............................U.............................U.....

  
>> SNMP: [1/0.37s] MySQL: [5/0.03s] RRD: [18/0.01s]  
>> Runtime for poller module 'applications': 0.3912 seconds with 94784 bytes  
#### Unload poller module applications ####

There is almost no difference in the walk, I don’t get why the discovery fails like this.
I tried to put double quotes around the command in the include in case discovery was parsing NET-SNMP-EXTEND-MIB::nsExtendCommand.“smart” looking for smart in it, but it wasn’t any better.

Can I have some help on it please? I’d like not to manually enable SMART everywhere.

Validate:

librenms@librenms-monitoring:~$ ./validate.php 
===========================================
Component | Version
--------- | -------
LibreNMS  | 23.11.0-32-g66cc34dbd (2023-12-14T18:29:02+01:00)
DB Schema | 2023_11_21_172239_increase_vminfo.vmwvmguestos_column_length (274)
PHP       | 8.2.13
Python    | 3.12.0
Database  | MariaDB 10.5.23-MariaDB
RRDTool   | 1.8.0
SNMP      | 5.9.4.pre2
===========================================

[OK]    Composer Version: 2.6.6
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database Schema is current
[OK]    SQL Server meets minimum requirements
[OK]    lower_case_table_names is enabled
[OK]    MySQL engine is optimal
[OK]    Database and column collations are correct
[OK]    Database schema correct
[OK]    MySQl and PHP time match
[OK]    Active pollers found
[OK]    Dispatcher Service not detected
[OK]    Locks are functional
[OK]    Python poller wrapper is polling
[OK]    Redis is unavailable
[OK]    rrdtool version ok
[OK]    Connected to rrdcached
[WARN]  Your local git contains modified files, this could prevent automatic updates.
	[FIX]: 
	You can fix this with ./scripts/github-remove
	Modified Files:
	 includes/definitions/cumulus.yaml

With the sudo one, discovery is showing that snmp is not responding. Are you sure you’ve started snmpd after making your changes?

1 Like

Unfortunately yes, snmpwalk is working, discovery is working except for smart, and polling is working.
And if I manually enable smart on the device settings, I get the graphs.
The timeouts are probably the cause, although I don’t know what is queried that fails.

OK it was an issue with a broken pmtu because of pfsense + ipsec.
I did fix this with setting route mtu in both LibreNMS ans monitored systems.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.