Grafana





THIS FEATURE HAS BEEN DEPRECATED 






XCALLY can be integrated with Grafana - open platform for analytics and monitoring - in order to create powerful dashboards.

Important

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Any assistance for the configuration and change of this plugin or the development of new plugins will be available as professional service from our team

About Grafana

This is a sample guide on how to use Grafana to create an XCALLY dashboard.

Grafana is a third party software and any information is provided “as is” without warranty of any kind.

For any installation/configuration issue please always refer to the Grafana official documentation.


Install Grafana

Grafana can be installed on different platforms, please refer to the official documentation here

Here is a simple guide about Grafana installation and basic configuration on a CentOS server.

https://grafana.com/grafana/download?platform=linux

Basically, you need to run the following commands, check the Grafana website for the latest release:

wget https://s3-us-west-2.amazonaws.com/grafana-releases/release/grafana-5.2.4-1.x86_64.rpm 
sudo yum localinstall grafana-5.2.4-1.x86_64.rpm


Enable the systemd service to start at boot

systemctl enable grafana-server.service

First basic configuration for a Grafana server without Motion plugin.

The Grafana settings are defined into the file /etc/grafana/grafana.ini

Enable the HTTPS protocol and configure the certificate path:

# Protocol (http, https, socket)
protocol = https
# https certs & key file
cert_file =/etc/pki/tls/certs/motion.crt
cert_key =/etc/pki/tls/private/motion.key


By default Grafana runs on the port 3000. If you need to change it, just change the following parameter:

For example, we changed the default port to 8080

# The http port  to use
http_port = 8080


Also set the domain and the root_url parameters in order to access to Grafana from external:

# The public facing domain name used to access grafana from a browser
domain = myserver.mycompany.com

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false

# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
root_url = https://myserver.mycompany.com:8080

For further details on the Grafana configuration files please check the following link:

http://docs.grafana.org/installation/configuration/

Please note every change in the Grafana config file requires the service restart

service grafana-server restart

First basic configuration for a Grafana server with Motion plugin.

Since the latest Grafana release blocks the CORS (Cross-Origin Resource Sharing), if you want to display the Grafana dashboards into the Motion application, you need to setup the Grafana server behind a proxy. In the example below you can find a sample of the Grafana and NGINX configuration


The Grafana settings are defined into the file /etc/grafana/grafana.ini.

Tu use Grafana behind a proxy, we can leave the http protocol.

# Protocol (http, https, socket)
protocol = http

By default Grafana runs on the port 3000. If you need to change it, just change the following parameter:

In this case, we change it to 3030

# The http port  to use
http_port = 3030


Now we set the localhost access only in order to do not bypass the proxy to access to Grafana from external:

# The public facing domain name used to access grafana from a browser
domain = localhost

# Redirect to correct domain if host header does not match domain
# Prevents DNS rebinding attacks
;enforce_domain = false

# The full public facing url you use in browser, used for redirects and emails
# If you use reverse proxy and sub path specify full url (with sub path)
root_url = http://localhost:3030


Please note every change in the Grafana config file requires the service restart

service grafana-server restart

Configure the NGINX server

Here is a basic nginx configuration file to put into the nginx folder /etc/nginx/conf.d/

In the example, we published the port 8080 and routed all the traffic to the http://localhost:3030 (previously defined into Grafana configuration)

grafana.conf

restart the nginx service 

service nginx restart


Add plugins to your Grafana server

Grafana has a very nice panels you'd like to use, here are our favorites, run the following commands to install them:

grafana-cli plugins install grafana-clock-panel
grafana-cli plugins install grafana-piechart-panel
grafana-cli plugins install grafana-worldmap-panel
grafana-cli plugins install natel-discrete-panel

and restart the grafana-server service to apply the changes.


Now you are able to connect to your Grafana server (use admin/admin as the default credentials)

Configure the XCALLY datasource

Add the MySQL user

Add a new MySQL user to use with Grafana, connect to the XCALLY MySQL database using the root credentials.

[root@xc-demo ~]# mysql -u root -p


mysql> CREATE USER 'xgrafana'@'myGrafanaServerIP' IDENTIFIED BY 'Password';
Query OK, 0 rows affected (0.01 sec)

Replace 'myGrafanaServerIP' with your Grafana server IP address or use 'localhost' if you installed Grafana on the XCALLY server

Replace 'Password' with a complex password.

Now, we set the user permissions on the motion2 database

mysql> GRANT SELECT ON motion2.* TO 'xgrafana'@'myGrafanaServerIP';
Query OK, 0 rows affected (0.00 sec)

Add the Datasource on the Grafana GUI

From the home page, click Add Datasource and choose the MySQL type.

Insert the MySQL user credentials and the XCALLY server IP (or localhost if Grafana is on the XCALLY server).


Create a Grafana user 

We suggest to create a "viewer" user for the agent access.

In the configuration section, you can invite a new user and set the proper permissions.

Import the sample XCALLY dashboards

go to https://myserver.mycompany.com:8080/dashboard/import

and upload the dashboard json file. Here are some examples:

  File Modified

File Motion V2 - Voice.json

Mar 08, 2019 by Valerio Ciotta

File XCALLY_dashboard.json

Feb 21, 2019 by Former user


Or paste the file content:

and load the XCALLY dashboard.



In order to use the XCALLY Grafana dashboard in the Motion App Zone, you need to obtain the shared link.

Click on the Share button and copy the link:


Use Grafana as XCALLY Motion plugin


In the App Zone section, add a new HTML plugin

and upload the following file:



Edit the plugin and configure the admin and the agent URL.

For example, you may want to give the admin console to the admin user and the XCALLY dashboard to the agents


Save the config and install the Plugin



Now the Grafana plugin is enabled for the XCALLY users, remember to set the proper permissions to the Agents



The agent GUI