Grafana Issues
Fixes for Grafana dashboard loading, port changes, login failures, and JIM data visibility.
Below are the issues related to Grafana:
- Dashboard Loading Issue
- Changing the Grafana Port from 3000 to 3001
- Grafana Login Issue
- Case 1: With HAProxy
- Case 2: Bug with the Existing Email ID
- Adding a Search Bar to the Grafana Dashboard
- Grafana Data Visibility Issue with JIM for JBOSS
- Issue with Failed Percentage Calculation in Grafana
- Incorrect Grafana URL
- Enabling JIM Trace Waterfall Access
- IMPS-CBS custom transaction data not displaying properly in Grafana
- Alert Summary Dashboard Issue
- IHS Data Not Appearing in Grafana Dashboard
For reference:
The following section contains basic Linux commands: Basic Commands
Dashboard Loading Issue#
The Grafana dashboard fails to load.

Solution: The problem is related to outdated index files, to resolve this, follow the below steps:
- Download the updated index file from the provided link.
-
Deploy the file to the following directory:
/opt/appnomic/Appsone_Service/grafana/public/views -
Ensure to update the file ownership and restart Grafana after the deployment.
Case 2: Error Accessing Grafana#
Errors encountered while accessing Grafana are depicted in the below images.


The root cause is identified as an outdated 'heal-dashboard' plugin in the 'grafana.nomad' file.
Solution:
- Remove the 'heal-dashboard' plugin, along with two other JavaScript files and the 'index.html' file, from the mount configuration.
- Validate the changes to ensure Grafana functions correctly.
Changing the Grafana Port from 3000 to 3001#
Follow the below procedure for Grafana port Change:
- Stop Grafana Service: Ensure Grafana service is not running during the port change process.
- Firewall Configuration: Add the new port (3001) to the firewall settings and reload the firewall.
- Backup Current Configuration: Create a backup of the current 'grafana.nomad' file.
-
Modify Port Settings: Change the port from 3000 to 3001 in the configuration:
port_map { grafana_web = 3001 } -
Update the resource settings in the configuration:
resources { cpu = 500 memory = 1048 network { mbits = "10" port "grafana_web" { static = "3001" } } -
Update the Consul service configuration to reflect the new port:
service/grafana/port:3001 -
Restart Grafana Service: After the changes, restart the Grafana service.
-
Accessing the Updated UI: Clear the browser cache and access the UI using the new address, For example:
https://192.0.2.82:3001
Grafana Login Issue#
Case 1: With HAProxy#
Users are repeatedly prompted to log in to Grafana when accessed via the same DNS name, routed behind HAProxy.
Solution Steps:
-
HAProxy Configuration:
-
Edit the below file:
Appsone_Service/conf/HAPROXY/haproxy.cfg -
Add the following entries:
frontend grafana_frontend bind :9434 ssl crt /etc/ssl/certs/haproxy.pem default_backend grafana_backend backend grafana_backend balance round-robin server grafana1 192.0.2.83:3000 check inter 3s rise 2 fall 3 ssl verify none
-
-
HAProxy Nomad File Changes: Modify the haproxy.nomad file:
port_map { haproxy_grafana = 9434 } network { port "haproxy_grafana" { static = "9991" } } -
Grafana Configuration:
-
Update the grafana.ini.tpl file at below directory:
/opt/appnomic/Appsone_Service/conf-template/grafana/ -
Replace IP addresses with the DNS name in all relevant places.
-
Additional Information: For Grafana 8.x, add the highlighted part in the haproxy.nomad file as per the below screenshots.
Case 2: Bug with the Existing Email ID#
Users are unable to log in to the Grafana dashboard.
The error is displayed as below:
Error 1062: Duplicate entry 'user@example.com' for
key 'user.UQE_user_login'
Unable to log in with the existing user email ID.
Solution:
- Delete the user and authentication details for the respective user from the below tables in the Grafana database using the email reference.
- grafana.user and
- grafana.user_auth
- Login from the UI using the dashboard. This action will create new entries in both tables.
Adding a Search Bar to the Grafana Dashboard#
Follow the below steps to rectify the issues:
- Dashboard Settings: Adjust the dashboard settings as required (details unavailable in the preview).
- Variable Creation: Create variables needed for the dashboard (details unavailable in preview).
-
Query Setup: Define necessary fields in the query.
Note: Establish a new data source to gather data from all indexes, such as 'logscan-raw*'.
-
Using Variables in Pods: Integrate these variables into the dashboard pods (details unavailable in preview).
Grafana Data Visibility Issue with JIM for JBOSS#
Incomplete data visibility in the Grafana dashboard for JBOSS, identified as a class_path loading issue in the production environment.
Actions Taken:
- Agent Cache Configuration:
- Add the agent.cache.refresh.interval=300 to agent.cache.properties.
- Restarting the JVM will led to the successful loading of the class_path.
-
JIM Activation in Production:
- Enable the JIM in the production environment.
-
Add the following entries to Host.xml.
<jvm-options> <!-- JVM options listed here --> </jvm-options>
-
Issue Encountered and Resolution:
- JVM startup issue due to a conflict with commons-logging-1.2.jar.
- Resolve by removing commons-logging-1.2.jar, enabling the complete data set collection in the production environment.
Issue with Failed Percentage Calculation in Grafana#
Problem Description:
Inability to calculate the failed percentage in the Grafana transaction dashboard using expressions or transformations, resulting in NaN values.
Suggested Solution:
-
Dashboard Configuration:
-
Utilize the provided sample configurations to design the dashboard.


Note: Addition operations function correctly, but division and multiplication do not yield expected results.
-
Incorrect Grafana URL#
Accessing the Grafana user interface redirects to an incorrect URL for Keycloak authentication, using a wrong IP address.
Solution :
-
Modification of grafana.ini File: The grafana.ini file was updated to include the correct IP address and port for Keycloak or the HAProxy (if UI access is routed through HAProxy).
-
Specific Changes Made: Under the Generic OAuth section in grafana.ini .
[auth.generic_oauth] name = Keycloak-OAuth auth_url = https://192.0.2.18:9998/auth/realms/master/protocol/openid- connect/auth token_url = https://192.0.2.18:9998/auth/realms/master/protocol/openid- connect/token api_url = https://192.0.2.18:9998/auth/realms/master/protocol/openid- connect/userinfo signout_redirect_url = "https://192.0.2.18:9998/auth/realms/master/protocol/openid- connect/logout?redirect_uri=https://192.0.2.18:3001" -
Deployment and Service Restart:
-
The updated grafana.ini file was mounted in the grafana.nomad file, specifically in the volumes section.
-
The Grafana service was restarted to apply these changes.
-
-
After updating the IP and port in the configuration and restarting the service, the Grafana UI correctly redirects to the intended URL for Keycloak authentication.
Enabling JIM Trace Waterfall Access#
To grant non-admin users access to the JIM Trace Waterfall feature in Grafana while restricting their ability to modify dashboards, follow the steps below:
Granting Editor Role to Non-Admin User:
-
Login to Grafana: Log in to Grafana using the "appsoneadmin " user.
-
Navigate to User Settings: On the home page, go to Settings → Users.
-
Assign Editor Role: Provide the "editor " role to the designated non-admin user.
Revoking Dashboard Permissions for Non-Admin User:
-
Navigate to Specific Dashboard: Go to the particular dashboard for which you want to enable JIM Trace Waterfall access.
-
Access Dashboard Settings: Click on the Settings tab for the selected dashboard.
-
Manage Permissions: Within the Settings tab, navigate to the Permissions tab.
-
Configure View Permission: Select the 'view ' permission for the 'editor ' role, ensuring that non-admin users with the editor role can only view the dashboard without modification capabilities.
IMPS-CBS custom transaction data not displaying properly in Grafana#
The data was displayed in Grafana, imps-out not displaying, and the transaction count is mismatching.

Solution:
The 126th field was not printing wherever the 123rd files have value MBK , hence could not match the total count in the new dashboard.
The 126 files were missing in CBS-xpt1, and were added manually and restarted all the cbs pt pipeline and Logstash main containers.
Alert Summary Dashboard Issue#
The Alert Summary dashboard was not functioning correctly.
It was found that the reportarray.sh script was missing in the DR environment.
The script was copied from DC to DR, executed in DR, and a cronjob was enabled for it. This script enables is_array:true in the heal-anomalies index.
Even after running the script, data was not fetched correctly from the OpenSearch index.
Solution:
The existing dashboard query is unable to fetch data from the OpenSearch index. After modifying the query, the data started appearing correctly in the Alert Summary dashboard.
-
Copy and enable reportarry.sh Script,
-
Copy the below script from DC to DR and execute the script in DR
reportarray.sh -
Enable a cronjob for the script to run at the time of index creation: The script enables is_array:true in the heal-anomalies index.
-
-
Modify the Dashboard Query: The existing query was modified to fetch the correct data from the OpenSearch index.
Before Modification:
SELECT a.Application as ApplicationName, a.Time, a.kpiName as KPI, a.signalid as Signal, b.currentStatus as Status, COUNT(a.kpiName) as Count, (select name from healsql.appsone.mst_sub_type where id=cast(a.severity as BIGINT)) as Severity FROM ( SELECT substr(cast(cast(from_unixtime(cast(starttime AS BIGINT)) AT TIME ZONE 'UTC+05:30' AS TIMESTAMP) AS VARCHAR), 1, 19) AS startTime, substr(cast(cast(from_unixtime(cast(expectedAnomalyClosingTime AS BIGINT)) AT TIME ZONE 'UTC+05:30' AS TIMESTAMP) AS VARCHAR), 1, 19) AS endTime, substr(cast(timestamp_in_gmt AT TIME ZONE 'UTC+05:30' AS VARCHAR), 1, 11) AS Time, (SELECT distinct application_name FROM healsql.appsone.view_application_service_mapping WHERE service_identifier = serviceId) AS Application, (SELECT name FROM healsql.appsone.mst_kpi_details WHERE id = kpiid) AS kpiName, anomalyid, signalid, severity FROM ( SELECT timestamp_in_gmt, substr(cast(json_extract(cast(metadata AS JSON), '$.starttime') AS VARCHAR), 1, 10) AS starttime, substr(cast(json_extract(cast(metadata AS JSON), '$.expectedAnomalyClosingTime') AS VARCHAR), 1, 10) AS expectedAnomalyClosingTime, anomalyid, kpiid, transform(signalids, x -> array_join(split(x, ','), ',')) AS signalids, severity, serviceId FROM healos.heal."heal_anomalies_app*_2024.w52,heal_anomalies_app*_2024.w 01,heal_anomalies_app*_2024.w2*" WHERE serviceId IN($service_Identifier) AND timestamp_in_gmt AT TIME ZONE 'Asia/Kolkata' >= $__timeFrom() AND timestamp_in_gmt AT TIME ZONE 'Asia/Kolkata' <= $__timeTo() ) a CROSS JOIN UNNEST(signalids) AS t(signalid) ) a JOIN ( SELECT signalId, currentStatus FROM healos.heal."heal_signals_app*_2024.w52,heal_signals_app*_2024.w01,h eal_signals_app*_2024.w2*" ) b ON a.signalid = b.signalId GROUP BY a.Application, a.kpiName, a.signalid, b.currentStatus, a.severity, a.Time ORDER BY Time DESCAfter Modification:
SELECT a.Application as ApplicationName, a.Time, a.kpiName as KPI, a.signalid as Signal, b.currentStatus as Status, COUNT(a.kpiName) as Count, (select name from healsql.appsone.mst_sub_type where id=cast(a.severity as BIGINT)) as Severity FROM ( SELECT substr(cast(cast(from_unixtime(cast(starttime AS BIGINT)) AT TIME ZONE 'UTC+05:30' AS TIMESTAMP) AS VARCHAR), 1, 19) AS startTime, substr(cast(cast(from_unixtime(cast(expectedAnomalyClosingTime AS BIGINT)) AT TIME ZONE 'UTC+05:30' AS TIMESTAMP) AS VARCHAR), 1, 19) AS endTime, substr(cast(timestamp_in_gmt AT TIME ZONE 'UTC+05:30' AS VARCHAR), 1, 11) AS Time, (SELECT distinct application_name FROM healsql.appsone.view_application_service_mapping WHERE service_identifier = serviceId) AS Application, (SELECT name FROM healsql.appsone.mst_kpi_details WHERE id = kpiid) AS kpiName, anomalyid, signalid, severity FROM ( SELECT timestamp_in_gmt, substr(cast(json_extract(cast(metadata AS JSON), '$.starttime') AS VARCHAR), 1, 10) AS starttime, substr(cast(json_extract(cast(metadata AS JSON), '$.expectedAnomalyClosingTime') AS VARCHAR), 1, 10) AS expectedAnomalyClosingTime, anomalyid, kpiid, transform(signalids, x -> array_join(split(x, ','), ',')) AS signalids, severity, serviceId --FROM $index1 --FROM healos.heal."heal_anomalies_app*_2024.w52,heal_anomalies_app*_2024.w 01,heal_anomalies_app*_2024.w2*" FROM healos.heal."heal_anomalies_app*_2024.w21" --FROM healos.heal."heal_anomalies_app_2024.w22,heal_anomalies_app_2024.w23" WHERE serviceId IN($service_Identifier) AND timestamp_in_gmt AT TIME ZONE 'Asia/Kolkata' >= $__timeFrom() AND timestamp_in_gmt AT TIME ZONE 'Asia/Kolkata' <= $__timeTo() ) a CROSS JOIN UNNEST(signalids) AS t(signalid) ) a JOIN ( SELECT signalId, currentStatus --FROM $index2 -- FROM healos.heal."heal_signals_app*_2024.w52,heal_signals_app*_2024.w01,h eal_signals_app*_2024.w2*" FROM healos.heal."heal_signals_app*_2024.w21" --FROM healos.heal."heal_signals_app_2024.w22,heal_signals_app_2024.w23" ) b ON a.signalid = b.signalId GROUP BY a.Application, a.kpiName, a.signalid, b.currentStatus, a.severity, a.Time ORDER BY Time DESC
IHS Data Not Appearing in Grafana Dashboard#
IHS data is not visible in the Grafana dashboard.
RCA: The disk space on the database server exceeded the OpenSearch watermark value, preventing OpenSearch from creating new indices. The following commands were executed to diagnose the issue:
curl -ku admin:admin -XPUT
https://192.0.2.84:9200/_cluster/settings
curl -XGET "https://192.0.2.84:9200/_cat/shards?v" -k -u
'admin:admin'
curl -sku 'admin:admin' -XGET
"https://192.0.2.84:9200/_cat/shards/logscan-raw-gls_web-ihsacl-
2024.09.16?v"
Logstash logs indicated errors with indices:
[2024-09-16T06:33:42,289][INFO ][logstash.outputs.elasticsearch]
retrying failed action with response code: 503
({"type"=>"unavailable_shards_exception", "reason"=>"[logscan-raw-
gls_web-ihsacl-2024.09.16][0] primary shard is not active Timeout:
[1m], request: [BulkShardRequest [[logscan-raw-gls_web-ihsacl-
2024.09.16][0]] containing [125] requests]"})
Solution:
Clear unwanted files and free up disk space to bring usage below the watermark value.