Checking The Status Of Your ELB With Zabbix

In my current environment (not for this blog lol) I leverage multiple ELBs to provide multi availability zone HA. We also use Zabbix to monitor our EC2 environment (in a previous post I extended the Mikoomi EC2 Zabbix plugin) so I figured I would create a way to have Zabbix alert on outages with backend nodes configured in our ELBs.

Template

Here are the items which are configured in our AWS ELB Template:

  • AWS Total Elastic Load Balancers
  • AWS Number Of Elastic Load Balancers With Out Of Service Pool Members
  • AWS Elastic Load Balancers With Out Of Service Pool Members
  • AWS Instance IDs of Out Out Service Pool Members

The following is a list of “Triggers” which come configured with the template:

  • An Elastic Load Balancer Has A Pool Member Out Of Service In {HOSTNAME}

Here is the Zabbix template which needs to be imported into your Zabbix Web Interface:

https://github.com/bcarpio/zabbix-aws-elb/blob/master/zbx_aws_elb_template.xml

ELB.py

To make the Zabbix template work you need to put the elb.py file on your zabbix server in the “ExternalScripts” location which is defined in your zabbix_server.conf file. On my system this is /usr/local/etc/zabbix/bin (but I modify my config specifically to this value).

This script requires the following options:

  • -k – AWS Access Keys
  • -s – AWS Secret Access Key
  • -r – Region (us-west-1 or us-east-1, etc..)
  • -n – Name – This is the NAME of the node as defined in your Zabbix web interface. For instance I define a node as US-EAST-1 and then assign the AWS ELB Template to that node

Here is the script:

https://github.com/bcarpio/zabbix-aws-elb/blob/master/elb.py

ELB.sh

For some reason I have a problem passing switches to script in the Zabbix web interface, so I simply wrote a wrapper around the elb.py script that sends the output of the elb.py script to a file, and then calls zabbix_sender to actually to a bulk send of the output of elb.py to the Zabbix server. This also needs to go into your “ExternalScripts” directory as defined in your zabbix_server.conf file:

https://github.com/bcarpio/zabbix-aws-elb/blob/master/elb.sh

Configure A Node In Zabbix
Finally you will want to configure a node in Zabbix which uses this script:

  • Configuration >> Hosts >> Create Host
  • Name: (Personally I Name This After My Region)

Next, you are going to want to define the following macros:

  • {$AWS_ACCOUNT_ACCESS_KEY}
  • {$AWS_ACCOUNT_SECRET_KEY}
  • {$AWS_REGION}

Finally, you will simply attach the Template_Amazon_ELB_AWS to the US-EAST-1 host.

Hopefully this helps you with the monitoring of your AWS ELBs.

 

Tags:, , ,

Add a Comment

Your email address will not be published. Required fields are marked *