Grafana

From The TinkerNet Wiki
Jump to navigation Jump to search

How To Install Grafana on Linux Mint 20

https://grafana.com/docs/grafana/latest/installation/debian/

Installation was tested on a fresh VM of Mint 20 so if i screwed something up, it wasn't going to be my Automation server

There are 2 versions that could be installed -OSS and Enterprise. It is suggested by Grafana to install the Enterprise version for stability. We will be installing the latest version in this setup. Run the following in a teminal window that is local or SSH'd into your system that will host it...

  • sudo apt-get install -y apt-transport-https
  • sudo apt-get install -y software-properties-common wget
  • wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -

Add the repository to the list and install

  • echo "deb https://packages.grafana.com/enterprise/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
  • sudo apt-get update
  • sudo apt-get install grafana-enterprise

Start the Server

  • sudo systemctl daemon-reload
  • sudo systemctl start grafana-server

Verify that its running properly

  • sudo systemctl status grafana-server

Now configure it to start at boot

  • sudo systemctl enable grafana-server.service

Package details

  • Installs binary to /usr/sbin/grafana-server
  • Installs Init.d script to /etc/init.d/grafana-server
  • Creates default file (environment vars) to /etc/default/grafana-server
  • Installs configuration file to /etc/grafana/grafana.ini
  • Installs systemd service (if systemd is available) name grafana-server.service
  • The default configuration sets the log file at /var/log/grafana/grafana.log
  • The default configuration specifies a SQLite3 db at /var/lib/grafana/grafana.db
  • Installs HTML/JS/CSS and other Grafana files at /usr/share/grafana

Getting Started with Grafana

The home for this information is here:

https://grafana.com/docs/grafana/latest/getting-started/getting-started/

Open a browser to your new Grafana install, in my case its 192.168.1.139:3000

Default user is admin/admin and it will make you change the password

The test install login is admin/Fiddlehead

Connecting with InfluxDB

https://grafana.com/docs/grafana/latest/datasources/influxdb/

Open up the GUI for Grafana on your host machine. Log in and click on the little icon that looks like 4 boxes on the left tab. This is the 'Dashboards' button. One of the options will be 'Data Sources'. Click that and select 'Add Data Source'.

Give the data source a meaningful name. I gave mine 'InfluxDB'. Select the query language 'InfluxQL'.

My databases are not set up for authorization or credentials since this setup will not be allowed to go play in the streets so all auth is turned off.

Scroll down to 'InfluxDB Details'. Put in the name of your new database if this is the first one being added, or the name of the additional database you want in the system. Put in the username and password. Select the type of http access you want. The simple version is 'GET'. If you are going to be doing long requests then select 'POST'. Hit 'Save and Test'. You should get a green bar that says you are connected to the proper database and all is well.

Adding in a data stream from Node Red

Presumably, you went through all this trouble so you could graph and map the giant amount of data you are creating in your IoT gear around your home. Open Node Red and go to Manage Pallete. Chances are you installed the v2.0 of Influx DB so you will need the 'NodeRed - Contrib - Stackhero- InfluxDB - v2' pallette.

Utilizing that pallete........ Dunno yet