monit_exporter periodically scrapes the monit status and provides its data via HTTP to Prometheus.
These metrics are exported by monit_exporter
:
name | description |
---|---|
monit_service_check | Monit service check info with following labels provided:
Value of this metric is representing "error". Means: 0 is "service is fine" whereas > 0 means, there is an error. |
monit_service_cpu_perc | Monit service CPU info with following labels:
|
monit_service_mem_bytes | Monit service mem info with following labels:
|
monit_service_network_link_state | Monit service link states
Value can be either -1 = Not available, 0 = down and 1 = up |
monit_service_network_link_statistics | Monit service link statistics
|
monit_service_port_response_times | Monit service port, unix socket and icmp checks response times
|
monit_service_read_bytes | Monit service Disk Read Bytes
|
monit_service_uptime | Service and server uptime in seconds
|
monit_service_write_bytes | Monit service Disk Writes Bytes
|
monit_up | Monit status availability. 0 = not available and 1 = available |
monit_version | Monit current version as label - the value is const 1. |
Services type provided correspond to the XML structure of monit:
type id | type name |
---|---|
0 | filesystem |
1 | directory |
2 | file |
3 | process |
4 | host |
5 | system |
6 | fifo |
7 | program |
8 | network |
This application is written in Go and has the following dependencies:
This application has the following build requirements:
- Git
- Go
To build the application from source, simply run the following commands:
git clone https://github.com/monofox/monit_exporter.git
cd monit_exporter
go build
The preferred way to use monit_exporter
is by running the provided Docker image. It is currently provided on GitHub Container Registry:
The following tags are available:
x.y.z
pointing to the release with that versionlatest
pointing to the most recent released versionmaster
pointing to the latest build from the default branch
The exporter will query the monit server every time it is scraped by prometheus. If you want to reduce load on the monit server you need to change the scrape interval accordingly:
scrape_configs:
- job_name: 'monit'
scrape_interval: 90s
static_configs:
- targets: ['localhost:9338']
To rebuild the application with the latest Go release, execute the following commands:
export GO_VERSION="1.21.3"
cd ~
curl --location https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz --output ~/go${GO_VERSION}.linux-amd64.tar.gz
tar xzvf ~/go${GO_VERSION}.linux-amd64.tar.gz
sudo rm -rf /usr/local/src/go
sudo mv ~/go /usr/local/src
echo 'PATH=$PATH:/usr/local/src/go/bin:$GOPATH/bin' | sudo tee /etc/profile.d/go.sh
source /etc/profile.d/go.sh
git clone https://github.com/monofox/monit_exporter.git
cd ./monit_exporter/
rm -f go\.mod go\.sum
sed -i 's@go-version: .*@go-version: ${GO_VERSION}@g' .github/workflows/release.yml
go mod init github.com/monofox/monit_exporter
go mod tidy
The application will load the config.toml
file located in the same directory if present.
Use the -conf
flag to override the default configuration file name and location.
To run the application, simply execute the Go binary.
Config parameter | Environment equivalent | Description | Type | Default |
---|---|---|---|---|
listen_address |
MONIT_LISTEN_ADDRESS |
address and port to bind | String | 0.0.0.0:9388 |
metrics_path |
MONIT_METRICS_PATH |
relative path to expose metrics | String | /metrics |
ignore_ssl |
MONIT_IGNORE_SSL |
whether of not to ignore ssl errors | Boolean | false |
monit_scrape_uri |
MONIT_MONIT_SCRAPE_URI |
uri to get monit status | String | http://localhost:2812/_status?format=xml&level=full |
monit_user |
MONIT_MONIT_USER |
user for monit basic auth, if needed | String | none |
monit_password |
MONIT_MONIT_PASSWORD |
password for monit status, if needed | String | none |
listen_address = "0.0.0.0:9388"
metrics_path = "/metrics"
ignore_ssl = false
monit_scrape_uri = "https://localhost:2812/_status?format=xml&level=full"
monit_user = "monit"
monit_password = "example-secret"
Distributed under the MIT License.
See LICENSE
file for more information.
Project: monit_exporter
Acknowledgements: