
Re-create an empty /etc/snmp/nf and add the following lines: master agentx # Keepalived requires agentx for SNMP We begin by backing up our default snmpd configuration.

Next, let’s create a very basic SNMP listener.

#Monit ubuntu 14.04 install#
The deedįirst of all, snmpd must be installed on the load balancers: $ sudo apt update sudo apt install snmpd In addition to tracking state changes, it potentially allows us to pull out all kinds of interesting statistics from keepalived, as long as we have a third machine from which to monitor things. Let’s set it up. A less amateurish way to go about it would to use keepalived’s built-in capability of running scripts on state changes, but there are a number of situations in which you can’t be sure that the scripts are able to run, so that’s not really what we want to do either.įortunately, keepalived supports SNMP, courtesy of the original author of the SNMP patch for keepalived, Vincent Bernat. This would be a pretty resource-intensive way of solving the issue, though. Monitoring state changes could naïvely be achieved by continuously tailing the syslog and searching for “entered the MASTER state”. The image to the right shows the intended – and at the end of this article achieved – result, with the color of the lines between nodes giving contextual information about the state of the running services. The drawback is that it’s hard to see if the site is served by the intended master or the backup load balancer at a glance. Up until now, I’ve considered it enough to monitor the VMs where the services run, and the general availability of a HAProxy listener on the common address.

Using keepalived in combination with a couple of HAProxy instances is a convenient yet powerful way of ensuring high availability of services.
