This is a simple exporter for monitoring DirectAdmin using Prometheus. It retrieves metrics from the DirectAdmin API and exposes them in a format that can be scraped by Prometheus.
To install and set up the DirectAdmin Exporter, follow these steps:
-
Clone the repository:
git clone https://github.com/piotr-ku/directadmin-exporter.git
-
Install the required dependencies. Make sure you have Go installed.
-
Build the exporter:
go build -o directadmin-exporter
-
Run the exporter:
./directadmin-exporter
Before running the DirectAdmin Exporter, make sure you have the following prerequisites:
- Go (version 1.23 or later)
- DirectAdmin API credentials
To run the application, use the following command:
./directadmin-exporter --port <port-number> --ip <ip-address> --config <config-file-path>
Replace the placeholders with the appropriate values:
<port-number>
: Port number for the HTTP server (default: 8080)<ip-address>
: IP address for the HTTP server (default: 127.0.0.1)<config-file-path>
: Path to the configuration file<interval>
: Interval between API requests (default: 10s)
The DirectAdmin Exporter requires an API configuration to connect to the DirectAdmin server. Create an environment file in the following format:
DIRECTADMIN_HOSTNAME=<directadmin-hostname>
DIRECTADMIN_USERNAME=<directadmin-username>
DIRECTADMIN_TOKEN=<directadmin-token>
DIRECTADMIN_PORT=<directadmin-port>
DIRECTADMIN_PROTOCOL=<directadmin-protocol>
<directadmin-hostname>
: The hostname of the DirectAdmin server<directadmin-username>
: The username for the DirectAdmin API.<directadmin-token>
: The token or password for the DirectAdmin API.<directadmin-port>
: The port number on which the DirectAdmin server is running.<directadmin-protocol>
: The protocol to use for communication with the DirectAdmin server (http
orhttps
).
When running the application, provide the path to the environment file using the --config
flag:
./directadmin-exporter --config <config-file-path>
The DirectAdmin Exporter collects various metrics exposed by the DirectAdmin server. These metrics are scraped periodically and made available for Prometheus to scrape.
The metrics endpoint is available at /metrics
on the HTTP server.
A Grafana dashboard for visualizing the metrics collected by the DirectAdmin Exporter is available in the grafana
directory. Import this dashboard into your Grafana instance to monitor and analyze the DirectAdmin metrics conveniently.
Contributions to the DirectAdmin Exporter project are welcome. To contribute, please follow these guidelines:
- Fork the repository and create a new branch.
- Make your changes and ensure that the code is properly tested.
- Submit a pull request describing your changes and the problem they solve.
This project is licensed under the MIT License. See the LICENSE file for more information.