DRBD monitoring under Cricket

Prev Next

2. Installation

2.1. Disclaimer

The installation procedure described in the following paragraphs is provided "as is".

Script and config files worked on my platform and should work without too much modifications on yours. They need basic understanding of the Linux operating system and of course the DRBD and Cricket packages. I won't be held responsible for any damage and/or data lost.

2.2. Requirements

Those monitoring scripts have been developped and tested on the following platform:

2.3. How does it work?

The main goal was: To allow Cricket to access the data in /proc/drbd. Two methods: The second method was my preferred one. Why? Let Cricket how often gather some data, we don't have to take care of the collector availability. We only have to define a efficient and secure way to let the Cricket collector access the data.

The snmp daemon coming with the Net-SNMP package (previously known as UCD-SNMP) allows to define specific OIDs which returns output of shell scripts. So, I wrote a script which return values from /proc/drbd. The Cricket collector uses those OIDs to get and store them in RRD files. So simply!

Here is a compete overview of the process:

2.4. Installing the script

Just download and copy the
script in your favourite directory, usually /usr/local/bin. Just run it manually you should get something like:
     [root@ftp2 bin]# ./get_drbd_stat.sh
     0
     11688676
     11688676
     0
     0
     0
     [root@ftp2 bin]# cat /proc/drbd
     version: 0.6.12 (api:64/proto:62)

     0: cs:Connected st:Secondary/Primary ns:0 nr:11688676 dw:11688676 dr:0 pe:0 ua:0
     [root@ftp2 bin]#
Compare values returned by the script and /proc/drbd. You should get the same (execpt if you have a heavy replica ;-). The script checks if DRBD is running on the server (check if drbd.o module is loaded). In case of problem, it just exit with a status code -1.

2.5. Setting up the SNMP agent

Once the script reports correct values, edit your snmpd.conf and had the following lines:
exec .1.3.6.1.4.1.2021.50 drbd_stats /usr/local/bin/get_drbd_stat.sh
Please use an unused OID! Check the
snmpd.conf man page for more details.

I assume that the Cricket collector as already access to your snmpd via a correct community (do NOT use "public") and ACL. Refer to the Net-SNMP documentation if needed.

Now test from the Cricket node, try to read the OIDs, you should get something like:

     [root@cricket bin] # snmpwalk -v 1 -c my_community ftp2 .1.3.6.1.4.1.2021.50
     UCD-SNMP-MIB::ucdavis.50.1.1 = INTEGER: 1
     UCD-SNMP-MIB::ucdavis.50.2.1 = STRING: "drbd_stats"
     UCD-SNMP-MIB::ucdavis.50.3.1 = STRING: "/usr/local/bin/get_drbd_stat.sh"
     UCD-SNMP-MIB::ucdavis.50.100.1 = INTEGER: 0
     UCD-SNMP-MIB::ucdavis.50.101.1 = STRING: "0"
     UCD-SNMP-MIB::ucdavis.50.101.2 = STRING: "11696620"
     UCD-SNMP-MIB::ucdavis.50.101.3 = STRING: "11696620"
     UCD-SNMP-MIB::ucdavis.50.101.4 = STRING: "0"
     UCD-SNMP-MIB::ucdavis.50.101.5 = STRING: "0"
     UCD-SNMP-MIB::ucdavis.50.101.6 = STRING: "0"
     UCD-SNMP-MIB::ucdavis.50.102.1 = INTEGER: 0
     [root@cricket bin] #

2.6. Setting up the Cricket directory

I won't explain here how Cricket works and how to customize it. Please see
Setting up new devices in Cricket in the documentation.

We just have to create a new directory under the Cricket path and copy the files. Don't forget to edit them to reflect your configuration!

     [root@cricket /] # cd ~cricket/cricket-config
     [root@cricket /] # mkdir drbd; cd drbd
     [root@cricket drbd] # cp /tmp/Defaults /tmp/Target .
     [root@cricket drbd] # vi Target
     [root@cricket drbd] # compile

2.7. Download

For your convenience, all files are available for download
here.
Prev Home Next
Screenshots