How to use grafana

Installation

Go to https://grafana.com/grafana/download, and select a version. OSS Edition 8.5.3 is selected in this guideline.

For RHEL/CentOS

For OpenSUSE/SUSE

Start and Login

Start the Server

Login for the First Time

Add Data Source

Search and Add InfluxDB

influxdb
influxdb

After the configuration is completed, click Save & test.

Search and Add MySQL

mysql
mysql

After the configuration is completed, click Save & test.

Create Dashboard

create_dashboard

Add Panel in a Dashboard

add_panel

Save Dashboard

Click save button, enter a dashboard name, then save it.

Export Model

Click settings button in a dashboard, jump to JSON Model. Copy JSON Model content, and save it as a local JSON file.

Import Model

Grafana website offers some dashboard models. You can enter a dashboard URL or ID to load a model. Importing a local JSON file is also an alternative choice.
import

Add a Cluster Panel

The panel shows CPU utility and memory utility of a cluster.
cluster
Select InfluxDB as data source. Use cluster_metric as the measurement. Below describes data structure and field type of cluster_metric:

FieldType
timeTime
hostString
metricString
valueNumber

Specifically, metric includes:

As depicted in the following figures, choose Time Series as visualization, and select Percent(0-100) as Unit.
cluster_query
cluster_style
percentage
Or click pencil button to enter raw query mode, and input the SQL below:

Add Transform - Labels to fields, which changes label names into metric values.
cluster_transform

Add Node Panel

Two panels, CPU Utility and Memory Utility, will be added.
Select InfluxDB as data source. Use node_metric as the measurement. Below describes data structure and field type of node_metric:

FieldType
timeTime
hostString
metricString
valueString
Specifically, metric includes: 

CPU Utility Panel

The panel shows CPU utilities of all the nodes in a cluster.
node_cpu_utility
As depicted in the following figures, choose Time Series as visualization, and select Percent(0-100) as Unit.
node_query
cluster_style
percentage
Since the metric value type is string, it is essential to click pencil button and enter raw query mode first. Then input the SQL below.

Add Transform - Convert field type, which converts value's string type into digital type.
Add Transform - Labels to field, which changes label names into host names.
node_transform

Memory Utility Panel

The panel shows memory utilities of all the nodes in a cluster.
node_memory_utility
Enter raw query mode and input the SQL below.

Keep the rest same with CPU Utility Panel.

Add Job Status Panel

The panel shows the numbers of running and waiting jobs at present.
job_status
Select MySQL as data source. Use job_job as the table. Below describes data structure and field type of job_job:

FieldTypeDescription
idintPrimary key
scheduler_idvarcharScheduler ID
identity_strlongtextSaved in JSON format
job_namevarcharJob name
job_contentlongtextJob content
queuevarchar 
submit_timedatetime 
start_timedatetime 
end_timedatetime 
submittervarchar 
job_filevarcharJob file path
workspacevarchar 
scheduler_statevarcharScheduler state. There's a mapping relationship with the field state
statevarcharC: Completed; Q: Queuing; R: Running; H: Hold; S: Suspended; UN: Unknown
operate_statevarcharcreating; create_fail; created; cancelling; cancelled
delete_flagbooleanTo identify if the job is deleted
runtimeintJob runtime, displayed in second
standard_output_filevarcharStandard output file path
error_output_filevarcharError output file path
raw_infolongtextGenerated by scheduler command line with scheduler_id
reasonlongtextScheduling failure reason
commentvarchar 
exit_codevarchar 
treslongtextTrackable resources occupied for this job
create_timedatetime 
update_timedatetime 
user_commentlongtext 
As depicted in the following figures, choose Bar chart as visualization and add a query for each running and waiting state.  
job_status_query  
job_status_style  
Enter raw query mode and input the SQL below.  

Click save button after the dashboard is completed.

Appendix

Anonymous User Configuration for Grafana in LiCO

Modify auth.anonymous in /etc/grafana/grafana.ini

Modify /etc/lico/portal.conf as follows in order to add a grafana menu bar in LiCO.

After the configuration, restart LiCO.

JSON Model

Note: You need to replace data source UID with your own one before importing a local JSON Model. UID could be found within the data source URL. Take InfluxDB as an example, o59fryjnk is its data source UID.
db_uid
The following shows the JSON Model of the dashboard created above: