Update monit docs and update changelog/readme

This commit is contained in:
Daniel Nelson 2020-01-22 15:27:54 -08:00
parent 9fd400c9ac
commit ec35f07770
No known key found for this signature in database
GPG Key ID: CAAD59C9444F6155
5 changed files with 221 additions and 131 deletions

View File

@ -12,6 +12,7 @@
#### New Inputs #### New Inputs
- [infiniband](/plugins/inputs/infiniband/README.md) - Contributed by @willfurnell - [infiniband](/plugins/inputs/infiniband/README.md) - Contributed by @willfurnell
- [monit](/plugins/inputs/monit/README.md) - Contributed by @SirishaGopigiri
#### New Outputs #### New Outputs

View File

@ -236,6 +236,7 @@ For documentation on the latest development code see the [documentation index][d
* [mesos](./plugins/inputs/mesos) * [mesos](./plugins/inputs/mesos)
* [minecraft](./plugins/inputs/minecraft) * [minecraft](./plugins/inputs/minecraft)
* [mongodb](./plugins/inputs/mongodb) * [mongodb](./plugins/inputs/mongodb)
* [monit](./plugins/inputs/monit)
* [mqtt_consumer](./plugins/inputs/mqtt_consumer) * [mqtt_consumer](./plugins/inputs/mqtt_consumer)
* [multifile](./plugins/inputs/multifile) * [multifile](./plugins/inputs/multifile)
* [mysql](./plugins/inputs/mysql) * [mysql](./plugins/inputs/mysql)

View File

@ -36,7 +36,7 @@ mapped to the output.
- field1 (type, unit) - field1 (type, unit)
- field2 (float, percent) - field2 (float, percent)
- measurement2 + measurement2
- tags: - tags:
- tag3 - tag3
- fields: - fields:

View File

@ -1,148 +1,235 @@
# Monit Plugin # Monit Input Plugin
The monit plugin gathers metrics and status information about local processes, The `monit` plugin gathers metrics and status information about local processes,
remote hosts, file, file systems, directories and network interfaces managed and watched over by Monit. remote hosts, file, file systems, directories and network interfaces managed
and watched over by [Monit][monit].
To install Monit agent on the host please refer to the link https://mmonit.com/wiki/Monit/Installation The use this plugin you should first enable the [HTTPD TCP port][httpd] in
Monit.
Minimum Version of Monit tested with is 5.16 Minimum Version of Monit tested with is 5.16.
### Configuration: [monit]: https://mmonit.com/
[httpd]: https://mmonit.com/monit/documentation/monit.html#TCP-PORT
### Configuration
```toml ```toml
# Read metrics and status information about processes managed by Monit [[inputs.monit]]
[[inputs.monit]] ## Monit HTTPD address
#SampleConfig address = "http://127.0.0.1:2812"
address = "http://127.0.0.1:2812"
basic_auth_username = "test" ## Username and Password for Monit
basic_auth_password = "test" # username = ""
# password = ""
## Amount of time allowed to complete the HTTP request
# timeout = "5s"
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
# insecure_skip_verify = false
``` ```
### Tags: ### Metrics
All measurements have the following tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
### Measurements & Fields: - monit_filesystem
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- mode
- block_percent
- block_usage
- block_total
- inode_percent
- inode_usage
- inode_total
<optional description> + monit_directory
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- permissions
### Fields: - monit_file
Fields for all Monit service types: - tags:
- status_code - address
- monitoring_status_code - version
- monitoring_mode_code - service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- size
- permissions
### Measurement & Fields: + monit_process
Fields for Monit service type Filesystem: - tags:
- Measurement: - address
- monit_filesystem - version
- Fields: - service
- mode - paltform_name
- block_percent - status
- block_usage - monitoring_status
- block_total - monitoring_mode
- inode_percent - fields:
- inode_usage - status_code
- inode_total - monitoring_status_code
- monitoring_mode_code
- cpu_percent
- cpu_percent_total
- mem_kb
- mem_kb_total
- mem_percent
- mem_percent_total
- pid
- parent_pid
- threads
- children
Fields for Monit service type directory: - monit_remote_host
- Measurement: - tags:
- monit_directory - address
- Fields: - version
- permissions - service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- hostname
- port_number
- request
- protocol
- type
Fields for Monit service type file: + monit_system
- Measurement: - tags:
- monit_file - address
- Fields: - version
- size - service
- permissions - paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- cpu_system
- cpu_user
- cpu_wait
- cpu_load_avg_1m
- cpu_load_avg_5m
- cpu_load_avg_15m
- mem_kb
- mem_percent
- swap_kb
- swap_percent
Fields for Monit service type process: - monit_fifo
- Measurement: - tags:
- monit_process - address
- Fields: - version
- cpu_percent - service
- cpu_percent_total - paltform_name
- mem_kb - status
- mem_kb_total - monitoring_status
- mem_percent - monitoring_mode
- mem_percent_total - fields:
- pid - status_code
- parent_pid - monitoring_status_code
- threads - monitoring_mode_code
- children - permissions
Fields for Monit service type remote host: + monit_program
- Measurement: - tags:
- monit_remote_host - address
- Fields: - version
- hostname - service
- port_number - paltform_name
- request - status
- protocol - monitoring_status
- type - monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type system: - monit_network
- Measurement: - tags:
- monit_system - address
- Fields: - version
- cpu_system - service
- cpu_user - paltform_name
- cpu_wait - status
- cpu_load_avg_1m - monitoring_status
- cpu_load_avg_5m - monitoring_mode
- cpu_load_avg_15m - fields:
- mem_kb - status_code
- mem_percent - monitoring_status_code
- swap_kb - monitoring_mode_code
- swap_percent
Fields for Monit service type fifo: + monit_program
- Measurement: - tags:
- monit_fifo - address
- Fields: - version
- permissions - service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type program: - monit_network
- Measurement: - tags:
- monit_program - address
- Fields: - version
- last_started_time - service
- program_status - paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type network: ### Example Output
- Measurement:
- monit_network
- Fields:
- link_state
- link_mode
- link_speed
- download_packets_now
- download_packets_total
- download_bytes_now
- download_bytes_total
- download_errors_now
- download_errors_total
- upload_packets_now
- upload_packets_total
- upload_bytes_now
- upload_bytes_total
- upload_errors_now
- upload_errors_total
### Example Output:
``` ```
$ ./telegraf -config telegraf.conf -input-filter monit -test monit_file,monitoring_mode=active,monitoring_status=monitored,pending_action=none,platform_name=Linux,service=rsyslog_pid,source=xyzzy.local,status=running,version=5.20.0 mode=644i,monitoring_mode_code=0i,monitoring_status_code=1i,pending_action_code=0i,size=3i,status_code=0i 1579735047000000000
monit_system,address=http://localhost:2812,host=verizon-onap,hostname=verizon-onap,monitoring_mode=Monitoring\ mode:\ \ active,monitoring_status=Monitoring\ status:\ \ Monitored,platform_name=Linux,service=verizon-onap,status=Running,version=5.16 status_code=0i,cpu_system=1.9,cpu_user=4.7,cpu_wait=1.5,cpu_load_avg_1m=1.24,cpu_load_avg_5m=1.68,mem_percent=67.1,monitoring_status_code=1i,monitoring_mode_code=0i,cpu_load_avg_15m=1.64,mem_kb=10961012i,swap_kb=2322688,swap_percent=13.9 1578636430000000000 monit_process,monitoring_mode=active,monitoring_status=monitored,pending_action=none,platform_name=Linux,service=rsyslog,source=xyzzy.local,status=running,version=5.20.0 children=0i,cpu_percent=0,cpu_percent_total=0,mem_kb=3148i,mem_kb_total=3148i,mem_percent=0.2,mem_percent_total=0.2,monitoring_mode_code=0i,monitoring_status_code=1i,parent_pid=1i,pending_action_code=0i,pid=318i,status_code=0i,threads=4i 1579735047000000000
monit_remote_host,address=http://localhost:2812,host=verizon-onap,hostname=verizon-onap,monitoring_mode=Monitoring\ mode:\ \ passive,monitoring_status=Monitoring\ status:\ \ Monitored,platform_name=Linux,service=testing,status=Failure,version=5.16 status_code=32i,monitoring_status_code=1i,monitoring_mode_code=1i,remote_hostname="192.168.10.49",port_number=2220i,request="",protocol="DEFAULT",type="TCP" 1578636430000000000 monit_program,monitoring_mode=active,monitoring_status=initializing,pending_action=none,platform_name=Linux,service=echo,source=xyzzy.local,status=running,version=5.20.0 monitoring_mode_code=0i,monitoring_status_code=2i,pending_action_code=0i,program_started=0i,program_status=0i,status_code=0i 1579735047000000000
monit_fifo,address=http://localhost:2812,host=verizon-onap,hostname=verizon-onap,monitoring_mode=Monitoring\ mode:\ \ active,monitoring_status=Monitoring\ status:\ \ Monitored,platform_name=Linux,service=test2,status=Running,version=5.16 status_code=0i,monitoring_status_code=1i,monitoring_mode_code=0i,permissions=664i 1578636430000000000 monit_system,monitoring_mode=active,monitoring_status=monitored,pending_action=none,platform_name=Linux,service=debian-stretch-monit.virt,source=xyzzy.local,status=running,version=5.20.0 cpu_load_avg_15m=0,cpu_load_avg_1m=0,cpu_load_avg_5m=0,cpu_system=0,cpu_user=0,cpu_wait=0,mem_kb=42852i,mem_percent=2.1,monitoring_mode_code=0i,monitoring_status_code=1i,pending_action_code=0i,status_code=0i,swap_kb=0,swap_percent=0 1579735047000000000
monit_network,address=http://localhost:2812,host=verizon-onap,hostname=verizon-onap,monitoring_mode=Monitoring\ mode:\ \ active,monitoring_status=Monitoring\ status:\ \ Monitored,platform_name=Linux,service=test1,status=Failure,version=5.16 monitoring_status_code=1i,monitoring_mode_code=0i,download_packets_total=0i,upload_bytes_now=0i,download_errors_total=0i,status_code=8388608i,link_speed=-1i,link_mode="Unknown Mode",download_bytes_now=0i,download_bytes_total=0i,download_errors_now=0i,upload_packets_total=0i,upload_bytes_total=0i,upload_errors_now=0i,upload_errors_total=0i,link_state=0i,download_packets_now=0i,upload_packets_now=0i 1578636430000000000
monit_directory,address=http://localhost:2812,host=verizon-onap,hostname=verizon-onap,monitoring_mode=Monitoring\ mode:\ \ passive,monitoring_status=Monitoring\ status:\ \ Monitored,platform_name=Linux,service=test,status=Running,version=5.16 status_code=0i,monitoring_status_code=1i,monitoring_mode_code=1i,permissions=755i 1578636430000000000
``` ```

View File

@ -3,12 +3,13 @@ package monit
import ( import (
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"net/http"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/internal"
"github.com/influxdata/telegraf/internal/tls" "github.com/influxdata/telegraf/internal/tls"
"github.com/influxdata/telegraf/plugins/inputs" "github.com/influxdata/telegraf/plugins/inputs"
"golang.org/x/net/html/charset" "golang.org/x/net/html/charset"
"net/http"
) )
const ( const (
@ -211,12 +212,12 @@ func (m *Monit) Description() string {
} }
var sampleConfig = ` var sampleConfig = `
## Monit ## Monit HTTPD address
address = "http://127.0.0.1:2812" address = "http://127.0.0.1:2812"
## Username and Password for Monit ## Username and Password for Monit
username = "" # username = ""
password = "" # password = ""
## Amount of time allowed to complete the HTTP request ## Amount of time allowed to complete the HTTP request
# timeout = "5s" # timeout = "5s"