Thursday, December 31, 2009

Cluster Monitoring

A new version of CMON - the monitor for MySQL Cluster - has been released. Many thanks to everyone who helped me with bug fixing and beta testing!

CMON monitors all events and information that you can get from MySQL Cluster.

Some of the things that CMON monitors:
  • Cluster status (starting, started, stopped, recovering, degraded etc)
  • Data node status (started, stopped, starting etc)
  • Application (mysqld) node status (connected/disconnected)
  • DataMemory/IndexMemory/Tablespace utilization
  • Statistics from data nodes
  • Statistics from mysql servers
  • Replication (basic currenty) support -picks up if a mysql server is a slave and checks if is running or not
  • Alarm generation
There are pre-built binaries for Linux 64-bit (I have not got around yet to do debian and rpm packages), as well as source code. It has been tested in Fedora 9 , Ubuntu 9.04, Centos 4/5, but I have not had the possibility to test on Redhat/SLES/Debian yet, so it would be interesting to know if there are any issues with it there. There are also installation instructions and a deployment guide (PDF).

CMON uses the Management API to collect information from MySQL Cluster and puts this information in a MySQL database, so it can be queried using SQL. This makes it very easy to write scripts around it and there are some sample scripts on the CMON web page.
# Get the status of Cluster for cluster with clusterid=1:
root@centos4-1 bin]# ./get_cluster_status.sh --clusterid=1
STARTED

# Get the list of node ids for type NDBD so that we can iterate over them easily.
[root@centos4-1 bin]# ./get_node_ids.sh --clusterid=1 -t NDBD
3 4

# Get the status of the node 3
[root@centos4-1 bin]# ./get_node_status.sh --clusterid=1 --nodeid=3
STARTED
If you want you can also view the Cluster from a web interface (requires PHP), and you can get graphs using RRD.

Installation is very simple, just run the cmon_install.sh script that is part of the package which will ask you a number of questions and write a configuration file.

No comments: