Skip to content

LibreNMS import ​

LibreNMS describes how to recognise hundreds of network systems and which sensors each one has, in YAML files under resources/definitions. probeward admin import-librenms converts those files, from a LibreNMS checkout on your machine, into Probeward device templates. Discovery then names a recognised device for what it is and proposes its temperatures, fans, power supplies, optics, processors and memory, besides the usual SNMP sensors.

Nothing from LibreNMS ships with Probeward. You fetch LibreNMS yourself, or have the Compose installer fetch it for you, and the converted templates are written on your server, marked as converted from LibreNMS and under its licence. See licence.

In the Compose installation ​

The reference installation keeps its templates in the templates volume, mounted at /var/lib/probeward/templates, with PROBEWARD_TEMPLATE_DIR set to it. From deploy/:

sh
./install.sh --with-librenms 26.10.2

After the stack is up, the installer downloads that LibreNMS release from GitHub (https://codeload.github.com/librenms/librenms/tar.gz/refs/tags/26.10.2) into a new temporary directory, prints the SHA-256 of the download, unpacks only the files the importer reads, runs import-librenms --apply in a one-off container of the probeward service with that directory mounted read-only, prints the summary and deletes the download. The download happens only because you asked for it; Probeward itself contains nothing from LibreNMS.

The tag must be digits separated by dots. To have the download checked, give its checksum:

sh
./install.sh --with-librenms 26.10.2 --librenms-sha256 51a8563f534d0b0053375ac816b68199abb533f4ee10150adef4d82641d19b97

Without --librenms-sha256 the installer checks the checksum only for the release pinned for the importer's evidence test (26.10.2, in scripts/fetch-librenms.sh); for any other tag it prints the checksum and goes on. To re-import a newer release later, run it again with the newer tag: the importer replaces the files it wrote before (see re-importing). The volume survives docker compose up --force-recreate, upgrades and docker compose down; only down -v deletes it. backup.sh includes it (see backup and restore).

To preview first, or to use a checkout you already have, run the same container by hand with the checkout mounted read-only. It must be readable by the container's user (uid 10001):

sh
docker compose run --rm -T --no-deps -v /opt/librenms-src:/librenms:ro probeward \
    admin import-librenms /librenms
docker compose run --rm -T --no-deps -v /opt/librenms-src:/librenms:ro probeward \
    admin import-librenms /librenms --apply

The image's entry point is the probeward binary, so the command starts at admin.

Running it ​

On a host install (the deb package or your own build):

  1. Get a LibreNMS release, for example into /opt/librenms-src:

    sh
    curl -fL -o librenms.tar.gz https://codeload.github.com/librenms/librenms/tar.gz/refs/tags/26.10.2
    mkdir /opt/librenms-src && tar -xzf librenms.tar.gz -C /opt/librenms-src --strip-components=1

    A git clone works as well. Only resources/definitions, mibs, includes/discovery, LibreNMS/OS, LibreNMS/Util/Version.php and composer.json are read; no PHP is run.

  2. Set PROBEWARD_TEMPLATE_DIR for the server (see configuration), for example to /etc/probeward/templates, and make sure the directory exists.

  3. Preview the import:

    sh
    probeward-admin import-librenms /opt/librenms-src

    It prints one line per system (full, partial or none, see the report) and then what would be written:

    text
    LibreNMS 26.10.2 at /opt/librenms-src
    aos7                     partial  16 sensors converted, 0 skipped, 1 PHP discovery files
    apc                      partial  150 sensors converted, 3 skipped, 14 PHP discovery files
    ...
    815 systems: 357 converted fully, 451 partly, 7 not at all
    new      /etc/probeward/templates/librenms/aos7.yaml
    ...
    808 new, 0 changed, 0 unchanged, 0 invalid, 0 stale, in /etc/probeward/templates/librenms
    Nothing written. Run again with --apply to write the new and changed templates.
  4. Write the templates:

    sh
    probeward-admin import-librenms /opt/librenms-src --apply

The server reads the template directory at the start of every discovery job, so no restart is needed. Run a discovery on a subnet with such devices and the proposal names the converted template.

For the Compose installation see above.

OptionDoes
--os NAMEConvert only this system, by its LibreNMS name (ios, apc, routeros). Repeat for more.
--out DIRWrite here instead of $PROBEWARD_TEMPLATE_DIR/librenms. One of the two is needed.
--applyWrite the new and changed templates, and import-report.json beside them.
--detailList every part of a definition that was left out, and every note, per system.
--jsonPrint the report as JSON.

The command needs no database and no network. It reads at most 4 MiB per definition file.

Re-importing ​

Run it again against a newer LibreNMS release. Without --apply it shows, per template, whether it is new, changed, unchanged or invalid, and for a changed one what changed (detection rules, priority, name, sensors added, changed or removed, upstream version). A changed template gets the next version. Templates whose system is no longer in the checkout are listed as stale and are left in place; delete them yourself if you want them gone.

An invalid template is one that failed Probeward's own validation. It is never written; please report it.

Imported files start with a header saying where they came from. Do not edit them: the next import replaces them. To change one, copy it outside the librenms directory, give it a different id and a higher priority, and edit the copy.

Sensors that already exist on a device are not changed by a re-import. A new discovery proposes what the new templates say.

The report ​

StatusMeans
fullDetection and every sensor of the definition were converted, and the system has no discovery written in PHP.
partialA template was written, but something was left out or changed in meaning. --detail lists each part.
noneNo template: the detection rules could not be converted, so Probeward would never recognise the system.

A system is also partial when LibreNMS discovers some of its sensors with PHP code (includes/discovery/sensors/<class>/<system>.inc.php, a processor or memory pool file, or a discover... function in LibreNMS/OS/<System>.php). The importer does not run PHP, so those sensors are missing from the template; the files are named in the report.

The report written with --apply (import-report.json) holds the same information as --json.

What is converted ​

LibreNMSBecomes
sysObjectID, sysDescr and their _except and _regex formssys_object_id_starts_with, sys_descr_contains, sys_object_id_regex, sys_descr_regex, wrapped in not for the exceptions.
snmpget in detection, with any operatorsnmp_get, read only for devices the rest of the group already matched.
Sensors of every class in os_discovery, by table or scalarsnmp_custom_oid sensors with class and unit, expanded with snmp_table.
divisor, multiplier, user_func: fahrenheit_to_celsiusscale and offset.
descr with {{ $index }}, {{ $subindexN }}, {{ $count }} and columns of the same tableThe name, with columns read at discovery.
low_limit, low_warn_limit, warn_limit, high_limit as numbers or columnsFixed channel_limits or limits read per row.
skip_values on the value, a column or the indexskip rules.
statesA value_map with health up (ok), warning or down (critical). An unknown state keeps its label and gets no health of its own.
processorsA processor sensor in percent, with precision as scale; a negative precision means idle and is turned into busy. Warns above 75 %.
mempools with percent_usedA memory sensor in percent. Warns above 90 %.

Every imported template also carries the baseline SNMP sensors of the generic SNMP template: ping, uptime, CPU, memory and interfaces.

What is not converted ​

Each of these is reported per system, with its reason.

  • snmpwalk detection checks, which walk a whole subtree of every candidate device; the group that uses one is left out.
  • Regular expressions with look-around or back-references, which the regex engine Probeward uses does not have.
  • Memory pools given only as used, free and total sizes: there is no sensor that divides two objects. Only the percentage is read when both are given.
  • rrd_type: COUNTER sensors, which LibreNMS turns into a rate.
  • snmp_flags that change how values are read, and user_func other than the Fahrenheit conversion (mw_to_dbm, uw_to_dbm, dateToRuntime and others).
  • Skip rules on a fixed row of another table, or on the device's own fields.
  • Names that read a column at part of the index ({{ MIB::name:1 }}), decode the index, or use a template filter. The sensor is kept and named by its class and index, which the operator can rename.
  • OIDs given by MIB name that the minimal MIB reader cannot resolve, for example when no MIB file defines the module, or the module is defined in several directories and none is the one the definition names. Names are resolved from the files under mibs; nothing is fetched.
  • Storage definitions: the host resources disk sensors cover what an agent reports.
  • Inventory fields (hardware, version, serial, features, location), which Probeward does not keep.

Two differences are deliberate and noted per sensor: a fractional multiplier is used as written, where LibreNMS truncates it to a whole number and then ignores a zero; and for states sharing a value, the first is kept.

Which template wins ​

Of the matching primary templates the one with the highest priority wins. Imported templates are ranked in the order LibreNMS tries its definitions, so the one LibreNMS would pick is picked here:

PriorityTemplates
2999 down to 2000Systems whose detection needs no extra SNMP request, in LibreNMS's file order.
1999 down to 1000Systems whose detection reads an object with snmpget, which LibreNMS tries after the others.
82, 81The catch-all AirOS and FreeBSD definitions, just above the shipped Linux template (80), which matches neither.
60The catch-all Linux definition, below the shipped device.linux-net-snmp (80) and above device.generic-snmp (50).

So a plain Linux host keeps the shipped Linux template, and any more specific system that runs on Linux, such as a NAS or a firewall, gets its converted template.

Discovery cost ​

Detection that needs an snmp_get costs an SNMP request only for the devices whose other rules already match, and only for the templates still in the running. Tables are walked only for the template that won and for matching add-ons. Per device at most 512 objects are read for detection and at most 256 columns of at most 1024 rows each are walked. A device that matches no imported template costs nothing more than before.

How well it works ​

The importer's evidence test converts the pinned LibreNMS release and runs discovery against the SNMP recordings LibreNMS keeps for its own tests (tests/snmpsim), comparing with what LibreNMS recorded it found on each (tests/data). For release 26.10.2:

MeasureResult
Systems815: 357 full, 451 partial, 7 none. One definition file (os_discovery/scalance.yaml) is not valid YAML.
Sensor entries7056 in the definitions, 6694 converted.
Recorded devices1412. 1352 got the converted template of their own system. 47 got a shipped template, nearly all Linux hosts getting device.linux-net-snmp; 7 have no converted template; 5 recordings have no sysObjectID; 1 got another converted template.
Detection that needs snmp_get123 of 172 devices right.
Sensors LibreNMS found by converted entries20401, of which 19933 proposed, 19911 with the same reading and 17304 with the same name.
Of those, with a divisor5520, 5422 proposed, 5421 same reading.
Of those, state sensors7934, 7723 proposed, 7713 same reading.
All sensors LibreNMS found, PHP discovery included30376, of which 20046 proposed.
Processors from converted entries615, 614 proposed, 608 same reading.
Memory from converted entries183, 179 proposed, 177 same reading.

Most names that differ are the fallback names described above. Readings are compared after scaling, to within 0.006 or 0.01 %.

To run it yourself:

sh
just librenms-evidence

It downloads the pinned release into ~/.cache/probeward/librenms, checks its checksum, and prints the numbers. PROBEWARD_EVIDENCE_OUT=file.json also writes them to a file. Without PROBEWARD_LIBRENMS_DIR (which the recipe sets) the test is skipped with a message, so the normal test run needs no download.

Licence ​

LibreNMS is distributed under the GNU General Public Licence, version 3 or later. Probeward is distributed under the GNU Affero General Public Licence, version 3.

Probeward ships no LibreNMS file and nothing derived from one: no definitions, no MIBs, no converted templates, no recordings. The test fixtures are written by hand for an invented enterprise number. The importer is Probeward's own code that reads files you supply.

A template the importer writes is derived from LibreNMS's definitions and stays under their licence. Each says so in its header and in its source (origin, files, upstream version, checksum and licence). Using them on your own server is what the licence permits. If you pass converted templates on to someone else, you pass on files under the GPL and its terms apply to that.

AGPL-3.0-only