Configure Grafana Base URL
You can configure Grafana to use a base URL path instead of an open port.
By default, Grafana uses a given an IP address to bind to and port 3000 for HTTP. If you use proxies or firewalls that block port 3000, you can configure Moogsoft AIOps to use a custom base URL for Grafana using an Nginx reverse proxy. See the Nginx documentation for more information on Nginx reverse proxies.
Configure Nginx
Before you can add a custom base URL for Grafana, ensure you have set up an Nginx reverse proxy:
-
Open the Nginx SSL configuration file:
$MOOGSOFT_HOME/common/config/nginx/moog-ssl.conf
-
If you have Grafana installed on the same machine as Moogsoft AIOps , check the section relating to Grafana. The default sub-path is
/grafana/
. Open the$moog-proxies.conf
file and remove the following lines:# BEGIN ANSIBLE MANAGED BLOCK location /grafana { proxy_set_header Host $host; proxy_pass http://localhost:3000/; rewrite ^/grafana$ / break; rewrite ^/grafana(.*)$ $1 break; } # END ANSIBLE MANAGED BLOCK
-
At the end of the
$moog-proxies.conf
file, add the following lines:location /grafana/ { location /grafana/ { proxy_pass http://localhost:3000; rewrite ^/grafana$ / break; rewrite ^/grafana(.*)$ $1 break; } location ~ /grafana/public/plugins/moogsoft-aiops-app/{ root /var/lib/grafana/plugins/; rewrite ^/grafana/public/plugins/moogsoft-aiops-app/(.*)$ /moogsoft-aiops- app/dist/$1 break; } location ~ /grafana/public/plugins/moogsoft-aiops-datasource/{ root /var/lib/grafana/plugins/; rewrite ^/grafana/public/plugins/moogsoft-aiops-datasource/(.*)$ /moogsoft-aiops-app/dist/$1 break; } location ~ /grafana/public/plugins/{ root /var/lib/grafana/plugins/; rewrite ^/grafana/public/plugins(.*)$ $1 break; } location ~* /grafana/public/{ root /usr/share/grafana/public/; rewrite ^/grafana/public(.*)$ $1 break; } }
-
Save your changes and restart Nginx.
After completing these steps, you can configure a new base URL for Grafana.
Add the Base URL in Grafana
To add the new base URL in Grafana:
-
Edit the Grafana configuration file:
/etc/grafana/grafana.ini
. -
Modify the
domain
androot_url
properties as follows:-
Delete the semi-colons to uncomment.
-
Update the values to reflect your new domain and base URL:
domain = <your_domain_name> root_url = %(protocol)s://%(domain)s:/grafana
If you are using GrafanaCloud, you only need to change the domain to your Grafana domain name.
-
-
Save the changes and restart the Grafana server.
After you have completed these steps, you can access Grafana at the new base URL.