Skip to content
This repository has been archived by the owner on Feb 24, 2022. It is now read-only.

PHP scripts for sending Plesk server metrics to your Datadog dashboards!

Notifications You must be signed in to change notification settings

isra00/plesk_datadog_metrics

Repository files navigation

Cool Plesk metrics in your Datadog dashboards

plesk_datadog_metrics is a set of useful PHP scripts that can send some metrics from your Plesk server (whether it's localhost or a remote server) to your Datadog dashboards.

Setting up

The first thing to do is edit the init.php file and change the values of the following constants:

define('DATADOG_APIKEY', 'your datadog api key');
define('DATADOG_APPKEY', 'your datadog app key');

define('MYSQL_HOST', 'localhost');
define('MYSQL_USER', 'admin');
define('MYSQL_PASSWORD', 'your admin pasword');
define('MYSQL_DB', 'psa');

You can get your MySQL password in the file /etc/psa/.psa.shadow

If you don't know your API API Key or App Key, check your Datadog settings.

Run them with cron jobs

The scripts are intended to be launched by cron jobs like this:

* 0 * * * php /path/to/your/scripts/traffic_domain_month.php

With this example, the cron job would send data about traffic per domain to Datadog each day at 0:00AM.

Remember: it's up to you when and which scripts are executed, and by which system user. However, each script includes a recommended frequency of execution in the first comment of the source code.

Metrics

At this moment, just a few metrics are implemented:

  • Traffic per domain for the current month: traffic_domain_month.php
  • Number of domains: count_domains.php
  • Number of clients: count_clients.php
  • Number of mailboxes: count_mailboxes.php
  • Total HD space used: disk_used.php
  • Monthly visits per domain (requires AWStats): monthly_visits.php

Of course, you can add your own metrics. It's very simple! Just create a new script with the Skeleton and implement whichever metric you want.

Feel free to contact me at isra00 AT gmail DOT com if you want to have new metrics. I will try to implement them.

God bless you.

About

PHP scripts for sending Plesk server metrics to your Datadog dashboards!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages