Applicable to:
- Plesk for Linux
Question
How to monitor several Plesk servers with Grafana extension?
Answer
I. Installing Grafana
First, deploy a new separate Grafana service where you will add your Plesk instances and monitor them (Grafana installed by Plesk is locked and cannot be edited). Use one of the following ways:
-
Deploy Grafana using a Docker image in Plesk. It is needed to add the following variable to a Docker image:
CONFIG_TEXT: GF_INSTALL_PLUGINS=grafana-simple-json-datasource
-
Deploy Grafana manually using official Grafana installation guide.
II. Getting URL for the Data Source
URL for the data source has the following format:
https://hostname:8443/modules/monitoring/public/index.php/AUTH_TOKEN
To get AUTH_TOKEN
, follow these steps:
-
Connect to the Plesk server via SSH.
-
Get
AUTH_TOKEN
:# sqlite3 /usr/local/psa/var/modules/monitoring/monitoring.sqlite3 "SELECT value FROM params WHERE name = 'rrd_api_auth_token'"
NyuIz_uQ8oZ6SKw31eSCxNt-KAWDlQ8e6VScvyqt -
Put
AUTH_TOKEN
into the URL:https://hostname:8443/modules/monitoring/public/index.php/NyuIz_uQ8oZ6SKw31eSCxNt-KAWDlQ8e6VScvyqt
III. Adding Data Source to Grafana
-
In your Grafana installation, go to Configuration > Data Sources and click on Add data source.
-
On the next screen, type to find "SimpleJSON". Click on it.
-
Fill in Name and URL generated on previous step.
Note: If your Plesk UI is not secured with a valid SSL certificate, enable Skip TLS verify.
IV. Adding reports
That's it! Now you can create reports using metrics from Plesk on Grafana Dahsboards. Below is an example of how to create a report to monitor memory usage:
Comments
13 comments
The Plesk DB query shown no longer works, but I contacted Plesk support today, and they have a new query to use (and updated their support article) with the following AUTH_TOKEN query:
It is working great now, thanks for this article!
I now have a few Plesk servers with one central dashboard, working great, displayed on a tablet mounted at my desk.
Hi Christian Toller
Thanks for brining this to our attention!
We've updated the article with a correct command. See "Getting URL for the Data Source".
Hello, I am using the Grafana extension ( Advanced Monitoring) included in Obsidian and would like to add PROMETHEUS as Data Source.
[ext-grafana]
allowSuperAdmin = true
is stored in the Panel.ini. Unfortunately the integration of Prometheus does not work...
I followed these instructions https://prometheus.io/docs/visualization/grafana/#creating-a-prometheus-data-source
But I only get this error: Unknown error during query transaction. Please check JS console logs.
This one again says nothing ...
Anybody got an idea?
Greetings
Hey,
Im running an Ubuntu 18 vServer with Plesk. I did everthings which was recommended here, but I dont get any data, if I want to create the dashboard.
Tested with two servers, one with a ssl-cert for the login under https://domain.eu:8443 the other one with the standard login without ssl-cert.
Both not having any data.
What can I do? :/
Hello Marius Schulte
The cause of such behavior is unclear. Maybe other Pleskians could suggest something. I suggest creating a topic at our forum
sqlite3 /usr/local/psa/var/modules/monitoring/monitoring.sqlite3 "SELECT value FROM params WHERE name = 'rrd_api_auth_token'"
Error: unable to open database "/usr/local/psa/var/modules/monitoring/monitoring.sqlite3": unable to open database file
please update the document. plesk db "Select value from ModuleSettings Where name = 'rrd_api_auth_token'" returns nothing, and https://example.com:8443/modules/monitoring/public/index.php/AUTH_TOKEN returns File not found.
Mark S. we did not test integration with PROMETHEUS as a data source. Based on error it looks like Prometheus does not respond properly to query. My first advice would be to check that Prometheus server URL is accessible form server itself. E.g. if you use http://localhost:9090/ like in example make sure you may connect to it from SSH:
# telnet localhost 9090
Hello Jacob D Dean
Thank you for sharing your user experience.
In case getting stuck on one of the further stages, I suggest also contacting Grafana developers: https://github.com/grafana/grafana/issues/
Hi there,
just started my attempt to setup monitoring for my Plesk servers and I'm already stuck at getting the auth token:
No token!!!
I'm running Plesk Obsidian 18.0.38 Update #3 on Debian 10 with Extensions Grafana 1.2.5-258 and Monitoring 1.4.4-475
Am I missing something??
Thanks,
Christian
Hi,
I followed these instructions for my Plesk Obsidian server running v18.0.28 and get the success message when creating the data source "Data source is working," but when I go to add a panel to the dashboard and select the data source, I get an "Internal server error" response:
For reference, I am running Grafana locally on a MacBook. I've also tried running inside a Docker on the target machine and I get the same error. I have my IP whitelisted in the Plesk firewall for port 3000 and 8443, but the fact that it seems to test successfully when setting up the data source leads me to believe that is not the issue.
*************** Update **************
It appears it errors out on creation if you don't have a query, which makes sense, but I guess I expected a default query like in the animated screenshot in this article. It's a little confusing for Grafana to throw an error first thing, but that's not something you guys handle.
I am still having trouble with the filterable list of query options. I have to manually enter the query, for example: "cpu:percent-user:value".
Although, I figured out that you can inspect the JSON formatting of the Grafana panels in Plesk by left-clicking on the panel title, select "Inspect" and clicking "Panel JSON." Click "Copy to clipboard,", then paste it in your custom Grafana instances' panel by doing the same. Just make sure to reselect your data source before saving.
Ivan Postnikov
I will reach out to Grafana and/or the plugin developer, but in the meantime, is there anywhere I can get a list (or API query that will list) of all of the metrics available from Plesk that I can use in Grafana?
Hello Jacob D Dean
Sorry for the late response.
There's a way to provide all the metrics straight to Grafana.
Metrics are available at https://example.com:8443/modules/monitoring/public/index.php/AUTH_TOKEN
AUTH_TOKEN is stored in Plesk database, to get it (example output from a test server):
# plesk db "Select value from ModuleSettings Where name = 'rrd_api_auth_token'"
+------------------------------------------+
| value |
+------------------------------------------+
| _qzuAPkvl_BhbQd7ndj1_r_n-6av4FDfCSqHbwwL |
+------------------------------------------+
Use that URL as described here at "3. Add the datasource to Grafana".
This link leads to a blog, it's very detailed and you should be able to configure everything on your side.
Please sign in to leave a comment.