Monitoring Kemp Loadmaster using SNMP and Prometheus
We have been running Kemp Loadmaster as our primary load balancer for over a year now. It’s a very decent yet relatively low cost solution which has directly replaced our IIS reverse proxy (ARR) solution we’ve had for years.
The one thing missing is a modern monitoring solution. We are using Prometheus and Grafana so we somehow need to export metrics from the Kemp Loadmaster instances into Prometheus and build dashboards in Grafana. We have 2 options here.
One way is to use the API and build an exporter which exposes an endpoint for Prometheus to pull from. Someone already tried this and shared the project on Github. Unfortunately the project hasn’t seen an update in 3 years and it doesn’t work anymore, probably due to changed in the Kemp Loadmaster API.
The other way is to use SNMP. The Prometheus project contains an SNMP exporter ready for use, so this might work. The exporter uses modules defined in the snmp.yml which is by default filled with modules for all kinds of appliances like Cisco, APC, Unifi etc. But no module for Kemp Loadmaster. We have to dive deeper to get the metrics we want.
The SNMP exporter is able to generate custom modules using the MIB files provided by Kemp. I was able to generate a first version of the module which exports a bunch of metrics like active connections and network throughput. These metrics were then imported by Prometheus and could be queries by Grafana which resulted in a dashboard like this.
These are the steps I took to generate the snmp.yml and get the metrics in Prometheus.
See this Github Gist if you just want the snmp.yml.
Step 1: Generate Kemp Loadmaster module to use in snmp.yml
Run the following commands:
Copy the Kemp Loadmaster mibs to the mibs directory
Add the following part to the generator.yml file.
The following reads in from generator.yml and writes to snmp.yml.
Your snmp.yml should now include a kemp_loadmaster module. This snmp.yml should be used to run the SNMP exporter.
Step 2: Test run SNMP exporter with the generated snmp.yml
If you use Docker you can just mount a volume to the folder where your snmp.yml is at.
Once running the SNMP exporter should expose an endpoint at port 9116. You can test it by giving the ip address of hostname of the Kemp Loadmaster and the module in the url like this.
Step 3: Integrate SNMP exporter in Prometheus
After testing this you can include the SNMP exporter in your Prometheus stack and have it scrape data on a regular basis.
If you made it this far you deserve a little treat. Here is a link to my Grafana dashboard you can easily install.