Collecting MongoDB metrics using Diamond and Graphite
In this recipe, we will look at how to fetch metrics using Diamond metrics collector and send it to Graphite, a tool to store and view time series data.
Getting ready
You need a single-node MongoDB instance.
How to do it...
- Assuming you are using a Ubuntu/Debian system, install Diamond:
sudo apt install python-pip sudo pip install diamond
- Create required directories and the Diamond configuration file:
mkdir /etc/diamond mkdir /var/log/diamond
- Download the Graphite docker image, and start the container:
docker run -d\ --name graphite\ --restart=always\ -p 80:80\ -p 2003-2004:2003-2004\ -p 2023-2024:2023-2024\ -p 8125:8125/udp\ -p 8126:8126\ graphiteapp/graphite-statsd
- Start the Diamond collector:
/usr/local/bin/diamond -f
- Check the Diamond log file (
/var/log/diamond/diamond.log
) and ensure metrics are being collected. - Check the Graphite web UI. You should see your metrics as shown in the following sample:
How it works...
Diamond is an open...