extend version /usr/local/sbin/opnsense-version
(?<version>[\d._]+) \((?<hardware>[^)]+)\)
root@x-y-z:~ # ./opnsense-versionOPNsense 24.10_7 (amd64/OpenSSL)
root@x-y-z:~ # /usr/local/sbin/opnsense-versionOPNsense 24.10_7
root@x-y-z:~ # /usr/local/sbin/opnsense-version -NvAOPNsense 24.10_7 amd64
Happy to, I have a few more for net-snmpd / lldpd waiting in the wings too! The question I guess is, do any changes that have been made in the last 5 years now rely on the new default output of the command?
The net-snmpd plugin has an option to expose the version of OPNsense under a specific OID. This is a tickbox in the GUI provided by this plugin:This adds the following line to the snmpd config file:Code: [Select]extend version /usr/local/sbin/opnsense-versionThis has the effect of putting whatever the output is of that command, into that OID.
Quote from: TotalGriffLock on November 08, 2024, 02:01:57 pmThe net-snmpd plugin has an option to expose the version of OPNsense under a specific OID. This is a tickbox in the GUI provided by this plugin:This adds the following line to the snmpd config file:Code: [Select]extend version /usr/local/sbin/opnsense-versionThis has the effect of putting whatever the output is of that command, into that OID.Observium uses .1.3.6.1.4.1.2021.7890.1 which is what you get when you enable Observium support in the current version of the plugin. Just for reference - I have no idea why there are (at least) two different OIDs. Also Observium does not use opnsense-version but relies on its own "distro" script for all Unix platforms.
root@x-y-z:~ # snmpwalk -v3 -u xxx -a sha -x aes -A xxx -X xxx -l authPriv 127.0.0.1 .1.3.6.1.4.1.2021.7890.1UCD-SNMP-MIB::ucdavis.7890.1 = No Such Object available on this agent at this OID
root@nms:~ # snmpwalk -v2c -c public opnsense .1.3.6.1.4.1.2021.7890.1UCD-SNMP-MIB::ucdavis.7890.1.1.0 = INTEGER: 1UCD-SNMP-MIB::ucdavis.7890.1.2.1.2.6.100.105.115.116.114.111 = STRING: "/usr/local/opnsense/scripts/OPNsense/Netsnmp/distro.sh"UCD-SNMP-MIB::ucdavis.7890.1.2.1.3.6.100.105.115.116.114.111 = ""UCD-SNMP-MIB::ucdavis.7890.1.2.1.4.6.100.105.115.116.114.111 = ""UCD-SNMP-MIB::ucdavis.7890.1.2.1.5.6.100.105.115.116.114.111 = INTEGER: 5UCD-SNMP-MIB::ucdavis.7890.1.2.1.6.6.100.105.115.116.114.111 = INTEGER: 1UCD-SNMP-MIB::ucdavis.7890.1.2.1.7.6.100.105.115.116.114.111 = INTEGER: 1UCD-SNMP-MIB::ucdavis.7890.1.2.1.20.6.100.105.115.116.114.111 = INTEGER: 4UCD-SNMP-MIB::ucdavis.7890.1.2.1.21.6.100.105.115.116.114.111 = INTEGER: 1UCD-SNMP-MIB::ucdavis.7890.1.3.1.1.6.100.105.115.116.114.111 = STRING: "FreeBSD|SMP|amd64|OPNsense|24.7.8||"UCD-SNMP-MIB::ucdavis.7890.1.3.1.2.6.100.105.115.116.114.111 = STRING: "FreeBSD|SMP|amd64|OPNsense|24.7.8||"UCD-SNMP-MIB::ucdavis.7890.1.3.1.3.6.100.105.115.116.114.111 = INTEGER: 1UCD-SNMP-MIB::ucdavis.7890.1.3.1.4.6.100.105.115.116.114.111 = INTEGER: 0UCD-SNMP-MIB::ucdavis.7890.1.4.1.2.6.100.105.115.116.114.111.1 = STRING: "FreeBSD|SMP|amd64|OPNsense|24.7.8||"
extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/opnsense/scripts/OPNsense/Netsnmp/distro.shextend .1.3.6.1.4.1.2021.7890.2 hardware /bin/kenv smbios.planar.productextend .1.3.6.1.4.1.2021.7890.3 vendor /bin/kenv smbios.planar.makerextend .1.3.6.1.4.1.2021.7890.4 serial /bin/kenv smbios.planar.serial
That would be awesome!
./opnsense-version -oFreeBSD|SMP|amd64|OPNsense|24.7.8|vmware|
{% if OPNsense.netsnmp.general.enableobservium == '1' %}extend .1.3.6.1.4.1.2021.7890.1 distro /usr/local/sbin/opnsense-version -oextend .1.3.6.1.4.1.2021.7890.2 hardware /bin/kenv smbios.planar.productextend .1.3.6.1.4.1.2021.7890.3 vendor /bin/kenv smbios.planar.makerextend .1.3.6.1.4.1.2021.7890.4 serial /bin/kenv smbios.planar.serial{% endif %}