Client Install Script

We’ve had discussions about a client install script before, but nothing official, so I’m making a place to have a formal discussion on a client-side install to setup and config monitoring for LibreNMS clients.

Features to be implemented:

  • install and configure snmp
  • if flagged, install and configure check_mk
    • determine if xinetd or systemd should be used for check_mk
    • arguments passed to determine check_mk agents to be installed
  • if flagged, install and configure collectd
  • if flagged connect to the LibreNMS server and add the host, then initiate discovery and polling
1 Like

Languages:

  • python (2?)
  • bash
  • php

Python currently seems to be a good bet. Compared to bash, python 2 is in most modern base installs compared to python 3, and python has much better arguments parsing which may be important

Possibly an sh bootstrap, but that might not be needed.
Target Python 2, but test it on Python 3 too, to make sure it is portable (you can save that for the last step).

Adding to LibreNMS might be tricky depending on how you approach it. Adding from individual hosts, you would have to supply an api token to the installer. Pushing from a central location might be better as you could either add them directly if you are on the LibreNMS server, or supply credentials once.

1 Like

So far, I’ve started on a basic bootstrap in bash, and have a decent shell of the script in python 2.7. Currently, it handles and validates all arguments correctly, and has code that takes OS definitions from a yaml file hosted on github and uses it to instantiate an object it will use for installation. I.E. you define the “id”, what is returned in /etc/os-release, the the actually name of the OS, the package manager is uses, and the package(s) for each “component”, snmpd, collectd, xinetd (if you don’t specify using systemd to setup check_mk), etc. and uses the argument --operating-system passed to the script to use the right definition. Using a seperate yaml file will let others add support for new OSes simply (unless they have to define a new package manager to use), without having to edit the python code.

2 Likes

any thoughts around building a module for Puppet, Chef or Ansible?

at some point down the line. I need to get this working first, but since it’s just me atm, it’s slow progress as it’s currently not top priority at my day job, and my day job being interested in LibreNMS is often what gives me time to work on this stuff :stuck_out_tongue: