Since working on the initial integration of getting NetFlow to Grafana, I have been lucky enough to work with customers to test things out. During this process, there were a couple of features customers asked for:
- The ability to specify which exporter to graph data for.
- The ability to specify a data interval for the graph.
Both of these are popular features that exist within Scrutinizer today, so it makes sense to have them available for Grafana. Implementing new features required a modification to the original simple-json-datasource, which lead to the creation of a Plixer Data Source.
To be clear, this isn’t a full-blown custom Data Source. I have plans for that later, depending on how popular this integration turns out to be, but it is a slightly modified simple-json-datasource that will need to be installed on your Grafana server.
To import a custom Data Source in Grafana it needs to be installed under /var/lib/grafana/plugins. Your Grafana service then needs to be restarted. When the services are restarted, Grafana looks in that directory to see if there is anything new and then we are off to the races.
Import the Plixer Data Source
To makes things easy, I’ve made the Plixer Data Source code available on our GitHub. All you need to do to is create a directory in /var/lib/grafana/plugins and then clone the data source into it.
- SSH to Grafana and navigate to /var/lib/grafana/plugins
- Make sure your server has git installed and run ‘sudo yum install git’
- Create a directory to put the Plixer Data Source in with ‘mkdir PlixerDataSource’
- Inside this new directory, clone the Data Source with ‘git clone https://github.com/plixer/Plixer-Grafana.git’
- Restart the Grafana Service with ‘service grafana-server restart’
The Plixer Data Source will now be available from the dropdown menu on your Grafana server.
Import the Plixer Back-End Server
Since all we’ve done is modify the original data source we used for this integration, we can salvage all the code used for the backend server. Once again, I have made this code available on GitHub to make the process a bit easier.
- SSH to Scrutinizer and navigate to /home/plixer/scrutinizer/files
- Create a directory to put the Plixer Back End in with ‘mkdir PlixerGrafana’
- Inside this new directory clone the program with ‘git clone https://github.com/plixer/Plixer-Grafana-Backend.git’
- Make sure you server has pip 2.7 installed. You can run ‘pip -V’ to check.
- If pip is not installed install it with ‘yum –y install python-pip’
- Run ‘pip install –r requirements.txt’ to install required Python packages.
You’ll need to modify the settings.json file in order to get started.
Once this is done, you can start the program by running the command ‘python grafanaapp.py &’
You will see a message print saying that the server is up and listening on port 5000.
Connect Grafana to the Plixer Back-End Server
From here, go to the Plixer Data Source in Grafana and fill out the required information. Click Save & Test and you should be good to go.
The final step is creating our first dashboard within Grafana. To do this, hit the + sign in Grafana. Select Create Dashboard and then select Graph.
Finally, we want to edit this panel and select what data we want visualized. Under the metrics tab select a Report, Exporter, and Interval to graph in and wait for the data to appear.
All of the code for this integration is open source and available on GitHub. I would love to see the community improve this integration and bring new ideas for how Scrutinizer and Grafana can work together. If you would like to help develop this plugin, please download the code to get started!