Table of Contents

Grafana - Monitor

This documentation will be splitted in two sections, one regarding Platform related data and dashboard while the other regards Traffic Monitoring.
Generally speaking, many information in how to use Grafana and it's capabilities, refer to the following link.

The general data infrastructure is the following:

To diplay a specific data, create a new panel and select “InfluxDB” as data source.
In the “From” parameter you can select mesasurements, many options are visible when making the selection.
The most relevant data are the following:



Traffic Monitoring Data

The general data infrastructure is the following:


Upating Traffic Monitoring Data

Every month, once the “official” traffic reports are available, it is needed to update scripts and dashboard in order to aligh them with the “official” reports. In addition, it is required to update the dashboard each time a customer “recharges” its credit.
It is suggested to keep track of everything through a local file, for this option, there's the following link.

Monthly Update


Recharge Update


Add new tenants on the dashboard

To be able to add a new tenant on the dashboard of the monitor you must first login on the monitor DB and insert a new tenant, this process will be adapted by the monitor but an SQL query must be done first.

By accessing to a DB application, you must run this command on the “calculation” table:

INSERT INTO calculations (tenant_name, date_time, total) VALUES (‘TENANT’*, '2023-03-23 12:00:00', 0)

Be aware to change tenant_name to the one you're trying to add, ocne you've inserted the tenant under the calculation table, the tenant is added on the monitor environment.

After, you must duplicate an existing Dashboard from the Monitor, modify the credit and the tenant_name as previously specified with the same name you had gived to the sql statement, if there's a threshold you can addi it by navigating to the “Alert” tab and inserting the values, a common condition is:

WHEN LAST() OF query( A, 1m, now) IS BELOW (threshold)

Then, you have to add the calculation query on the “calculate.js” file located in the /home/centos/monitorTraffic folder. By doing so, you have to add a new line under the existing customer, feel free to use this template as an example:

// tenant_name
query="SELECT (SUM(CASE WHEN direction = 'outbound' AND (dest_number LIKE '3%' OR dest_number LIKE '00393%') THEN IFNULL(duration, 0) * 0.0350 / 60 ELSE 0 END) + SUM(CASE WHEN direction = 'outbound' AND (dest_number LIKE '0%' OR dest_number LIKE '00390%') THEN IFNULL(duration, 0) * 0.0130 / 60 ELSE 0 END)) AS total FROM generalTable_five WHERE call_start > '"+month+" 00:00:00' AND tenant_name = 'tenant_name' AND billing_provider LIKE 'Irideos%'";
 
queryArray.push(query);
tenant="tenant_name";
tenantArray.push(tenant);

Change the tenant_name with the one you've been given and the query as well. The query provided on the example is referred to only outbound traffic using the standard rates.
Therefore, run calculate.js by doing node calculate.js and everything will be Up&Running.

Antonio Andriychuk 2024/10/10 14:04