So, the last few weeks my colleagues and myself have been noticing that there has been a couple of issues with the cloud-servers servicenet interface. Unfortunately for some customers utilizing dbaas instances this means that their cloud-server will be unable to communicate, often, with their database backend.
The solution is a custom monitoring script that my colleague Marcin has kindly put together for another customer of his own.
The python script that goes on the server:
Create file:
vi /usr/lib/rackspace-monitoring-agent/plugins/servicenet.sh
Paste into file:
#!/bin/bash # ping="/usr/bin/ping -W 1 -c 1 -I eth1 -q" if [ -z $1 ];then echo -e "status CRITICAL\nmetric ping_check uint32 1" exit 1 else $ping $1 &>/dev/null if [ "$?" -eq 0 ]; then echo -e "status OK\nmetric ping_check uint32 0" exit 0 else echo -e "status CRITICAL\nmetric ping_check uint32 1" exit 1 fi fi
Create an alarm that utilizes the below metric
if (metric["ping_check"] == 1) { return new AlarmStatus(CRITICAL, 'what?'); } if (metric["ping_check"] == 0) { return new AlarmStatus(OK, 'eee?'); }
Of course for this to work the primary requirement is a Rackspace Cloud-server and an installation of Rackspace Cloud Monitoring installed on the server already.
Thanks again Marcin, for this golden nugget.