Grafana + InfluxDB: Difference between revisions

From HELIOS Digital DAQ
Jump to navigation Jump to search
No edit summary
 
(15 intermediate revisions by the same user not shown)
Line 9: Line 9:
[https://grafana.com/ Grafana]
[https://grafana.com/ Grafana]


= Present setting =
we move the database and grafana from HELIOSDB to MAC2017 from Jan, 2021
 
= TODO List after restarted the MAC2017 =
 
1)  open google chrome, login the grafana, put in the TV, make it full screen
 
2)  open a terminal and type
helios_monitor start
this will open two xterm windows, one for capturing screenshot and push it to the web, another one is for globus.
 
in the globus xterm, login as dgs@digios1. once login, start the globus by
globus
 
the "globus connect" window will pop up and click the connect.
 
3) if recording the leakage current is needed check out [[Leakage Current from Iseg]]
 
== to check the grafana and influxDB are running ==
 
brew services
 
if the grafana and influxdb@1 are not running,
 
brew services restart grafana
brew services restart influxdb@1
 
= Present setting =
 
Although the influxdb and grafana are moved to MAC2017, but the setting is the same.
 
 
 
== setting for HELIOSDB (obsolete) ==
The data (e.g. trigger Rate, threshold, Buffer ) must be taking in digios1, the DAQ.  
The data (e.g. trigger Rate, threshold, Buffer ) must be taking in digios1, the DAQ.  


Line 38: Line 70:
= Setup InfluxDB =
= Setup InfluxDB =


== MAC2017 ==
to install
brew install influxdb@1
it is important to use the 1.8.x version of the influxdb, unless someone update the whole DAQ for 2.X version.
to run the influxDB server
brew services start influxdb@1
to restart the server
brew services restart influxdb@1
to check is influxdb@1 running OK
brew services
== 64-bit linux ==
For 64bit-linux, the setup is straight forward.  
For 64bit-linux, the setup is straight forward.  


Line 54: Line 107:
= Setup Grafana =
= Setup Grafana =


== MAC ==
brew install grafana
brew services start grafana
in case need to restart
brew services restart grafana
== linux ==
  sudo apt-get update
  sudo apt-get update
  sudo apt-get install grafana
  sudo apt-get install grafana
Line 59: Line 122:
Or see Grafana webpage, straight forward.
Or see Grafana webpage, straight forward.


= SSH Tunneling to heliosDB from outside =
= SSH Tunneling to mac2017 from outside =


Since the Grafana is installed in heliosDB inside onenet. There is no simple way to check the Grafana from outside.
Since the Grafana is installed in mac2017 inside onenet. There is no simple way to check the Grafana from outside.


One solution is using <span style="color:red">sonata.phy.anl.gov</span> via ssh tunneling.
But we can use the ssh tunneling


  ssh -nNT -L 9000:heliosdb.onenet:3000 <username>@sonata
  ssh -L 9000:localhost:3000 -J <userName>@login.phy.anl.gov heliosdigios@mac2017


The above ssh command is using sonata, port-forwarding heliosdb.onenet:3000 to localhost:9000.  
This command let you port forwarding from mac2017:3000 to localhost:9000.  


After typing this in terminal, use any browser, type http://heliosDB.onenet:3000
After typing this in terminal, use any browser, type http://localhost:9000


= To push the Grafana screenshot to ANL web page =
= To push the Grafana screenshot to ANL web page =


we store a screenshot in http://www.phy.anl.gov/atlas/helios/grafanaElog.jpg
we store a screenshot in http://www.phy.anl.gov/atlas/helios/live/grafanaElog.jpg
 
A bash script in is coded to take the screenshot and push it to the webpage.
 
digios/daq/GrafanaWeb.sh
 
= Edit login timeout =
 
Grafana will logout user after 7 days. To change that, edit
linux :/etc/grafana/grafana.ini
Mac : /usr/local/etc/grafana/grafana.ini


A bash script in <span style="color:red">heliosDB</span> is coded to take the screenshot and push it to the webpage.
under the section [auth]. change the  


In order to run for every 60 sec, we use the "watch" command
login_maximum_inactive_lifetime_days = 300
login_maximum_lifetime_days = 300
token_rotation_interval_minutes = 432000


heliosDB:~>watch -n 60 ./GrafanaWeb.sh
and restart Grafana.


= To use dramatic sound alarm for Grafana =
= To use dramatic sound alarm for Grafana =


  heliosDB:~>./NewSoundAlarm.sh
  heliosDB:~>./NewSoundAlarm.sh

Latest revision as of 20:48, February 12, 2022

Introduction

In order to monitor the HELIOS system, for example, the threshold, the tigger rate, the buffer size, etc. We monitor and save those data into a database managed by InfluxDB. The database is further read by Grafana for display.

For more information on InfluxDB and Grafana, see:

InfluxDB documentation

Grafana

we move the database and grafana from HELIOSDB to MAC2017 from Jan, 2021

TODO List after restarted the MAC2017

1) open google chrome, login the grafana, put in the TV, make it full screen

2) open a terminal and type

helios_monitor start

this will open two xterm windows, one for capturing screenshot and push it to the web, another one is for globus.

in the globus xterm, login as dgs@digios1. once login, start the globus by

globus

the "globus connect" window will pop up and click the connect.

3) if recording the leakage current is needed check out Leakage Current from Iseg

to check the grafana and influxDB are running

brew services 

if the grafana and influxdb@1 are not running,

brew services restart grafana
brew services restart influxdb@1

Present setting

Although the influxdb and grafana are moved to MAC2017, but the setting is the same.


setting for HELIOSDB (obsolete)

The data (e.g. trigger Rate, threshold, Buffer ) must be taking in digios1, the DAQ.

Since the DAQ is running on a 32-bit system. the influxDB is unstable.

The database was installed in heliosDB.onenet or heliosDB.

Thus, the data will be push to heliosDB.

To run the monitor program, login to the DAQ (digios1.onenet)

digios1$ Helios_Database Start

To stop the monitor program,

digios1$ Helios_Database Stop

Grafana was also installed in heliosDB.

To run Grafana, from any browser, within onenet, type

http://heliosDB.onenet:3000

if no webpage found, probably the Grafana server is not started. To start the Grafana server

sudo service grafana-server start

Setup InfluxDB

MAC2017

to install

brew install influxdb@1

it is important to use the 1.8.x version of the influxdb, unless someone update the whole DAQ for 2.X version.

to run the influxDB server

brew services start influxdb@1

to restart the server

brew services restart influxdb@1

to check is influxdb@1 running OK

brew services

64-bit linux

For 64bit-linux, the setup is straight forward.

For example, in Ubuntu-18.x, simply type

sudo apt-get install influxdb

The influxdb contains 2 main programs,

  1. influx, for interactive database operations
  2. influxd, a daemon run in background, for receiving query from port 8086

To run the influxd

sudo service influxdb start

Setup Grafana

MAC

brew install grafana
brew services start grafana

in case need to restart

brew services restart grafana

linux

sudo apt-get update
sudo apt-get install grafana

Or see Grafana webpage, straight forward.

SSH Tunneling to mac2017 from outside

Since the Grafana is installed in mac2017 inside onenet. There is no simple way to check the Grafana from outside.

But we can use the ssh tunneling

ssh -L 9000:localhost:3000 -J <userName>@login.phy.anl.gov heliosdigios@mac2017

This command let you port forwarding from mac2017:3000 to localhost:9000.

After typing this in terminal, use any browser, type http://localhost:9000

To push the Grafana screenshot to ANL web page

we store a screenshot in http://www.phy.anl.gov/atlas/helios/live/grafanaElog.jpg

A bash script in is coded to take the screenshot and push it to the webpage.

digios/daq/GrafanaWeb.sh

Edit login timeout

Grafana will logout user after 7 days. To change that, edit

linux :/etc/grafana/grafana.ini
Mac : /usr/local/etc/grafana/grafana.ini

under the section [auth]. change the

login_maximum_inactive_lifetime_days = 300
login_maximum_lifetime_days = 300
token_rotation_interval_minutes = 432000

and restart Grafana.

To use dramatic sound alarm for Grafana

heliosDB:~>./NewSoundAlarm.sh