Our eMon Energy Monitor measures electricity use of a house, business, hotel or even a factory. While it’s internal webserver provides sophisticated graphs, you will get much better graphs, features and dashboards when the device uploads the data to a time-series server. The best one we know of is a combination of InfluxDB and Grafana.
In this article I will guide you through a very quick and easy way, with lots of pictures, to install a InfluxDB & Grafana server and to configure the eMon Energy Monitor to upload data to this server.
This is meant to gently introduce you to setting up a cloud server. I know “cloud server” sounds techie, but it really not more complicated than ordering a book from Amazon. The instructions below won’t take more than 15 minutes.
DigitalOcean offer a $5 per month “droplet” or mini-server with sufficent power, memory and storage to run InfluxDB & Grafana. First time customers get $100 credit that you can spend in the first two months. The droplets can be based in Singapore, Europe, etc. Choose a location closest to you.
Step 1. Create a DigitalOcean Account.
In any browser go to https://www.digitalocean.com
Click on Sign Up with email
Yes, enter your information and email address. Either use that old throwaway email address or create a new one.
You will get a confirmation email. When you receive that click on the link in the email. You will be asked to enter a credit card or paypal account. There is no way around it. I have used CCs from TransferWise, BCA and Mandiri without issues. I know Revolut will not be accepted.
Voila. You have created a DigitalOcean Account and created your project. You are ready to deploy your InfluxDB/Grafana server.
Step 2. Create a Server with InfluxDB and Grafana
1.Click on Ubuntu
4.Click on the closest location to you
5.Enter a password. Make sure to write it down somewhere. You will need it later.
6.No need to fill in the rest.
Click on Create Droplet
After that it will take a few minutes for you will get this .
Click on ubuntu-s-1vcpu……..
Click on Console on right hand.
Step 3. Install InfluxDB and Grafana
The image below will open up.
Seeing this window open, you may think “Whoa, this starts looking way too techie for me”. Rest assured, you will only need to enter 1 word, 1 password and 1 copy/paste ENTER and you are done.
1.Login - root
2.Password - the password you wrote down a few moments ago
2.a While you type in your password it will not show. You have to have faith and when done press ENTER.
3.Press the Copy button below, go back to the console and paste ( Windows: Ctrl + V - MacOS: Cmd + V) into that “techie” Window and press your keyboard ENTER key.
su -c "bash <(wget -qO- https://raw.githubusercontent.com/emonindonesia/influxdb-grafana-script/main/install.sh)" root
After you pressed the ENTER key a script will install InfluxDB and Grafana on your new DigitalOcean Droplet. After a few minutes it will say “Installation complete. Press ENTER to complete installation. Press the ENTER key.
Now you will be asked to enter database, username and password.
Database Username and Password: letters, digits, or underscores and do not begin with a digit.
Press ENTER key after each is entered.
Follow the instructions “How to set up Grafana…”. Write down the URL at Step 5.
Done with the “Console”, I would suggest you leave it open for a while, in case you forgot the database, username, password or URL.
Open a browser. Enter that URL. It will be something like http://127.03.123.55:3000 . The :3000 is required.
The Grafana login screen will open up.
The first time login username and password are: admin admin
You will be asked to create a NEW PASSWORD. Write that down.
Your Grafana Home screen will open.
Click on Configuration on the left-side. Click on Data Sources.
Click on Add data Source.
Click on InfluxDB.
Click on Copy below and paste that into the HTTP URL imput box
Futher down the page, enter your database, username and password.
Click on Save & Test.
A Green box should appear saying that Data Source is working
This concludes the Grafana and InfluxDB installation.
Step 5. Configuring eMon Energy Monitor
Open the webpage of your eMon Energy Monitor. Unless you changed the name of the device, type emon.local in your browser.
Click on “InfluxDB”
Before we continue, you need to find again that URL of your DigitalOcean Droplet you write down earlier. In the image below it is 22.214.171.124 Yours of course will be different.
1.Server URL: enter the DigitalOcean Droplet URL. Make sure to add http:// before the IP address
2.Datebase: name of your datebase you created earlier in the InfluxDB configuration
3.User Name: your InfluxDB username 4.User Password: your InfluxDB password 3.Measurements: Click on “add” to tell the device what data to send to your server.
When you have added all you want to, click on Save
Far more detailed instructions on the eMon Energy InfluxDB configuration can be found at:
Now go to your new Grafana server by entering it’s IP address in your Browser and adding :3000 e.g. 126.96.36.199:3000
Please have a look at Grafana’s documentation for detailed instructions. https://grafana.com/docs/grafana/latest/getting-started/getting-started/#step-3-create-a-dashboard