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
- [infiniband](/plugins/inputs/infiniband/README.md) - Contributed by @willfurnell
- [monit](/plugins/inputs/monit/README.md) - Contributed by @SirishaGopigiri
#### New Outputs

View File

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

View File

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

View File

@ -1,148 +1,235 @@
# Monit Plugin
# Monit Input Plugin
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.
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][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
# Read metrics and status information about processes managed by Monit
[[inputs.monit]]
#SampleConfig
address = "http://127.0.0.1:2812"
basic_auth_username = "test"
basic_auth_password = "test"
[[inputs.monit]]
## Monit HTTPD address
address = "http://127.0.0.1:2812"
## Username and Password for Monit
# 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:
All measurements have the following tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
### Metrics
### 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:
Fields for all Monit service types:
- status_code
- monitoring_status_code
- monitoring_mode_code
- monit_file
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- size
- permissions
### Measurement & Fields:
Fields for Monit service type Filesystem:
- Measurement:
- monit_filesystem
- Fields:
- mode
- block_percent
- block_usage
- block_total
- inode_percent
- inode_usage
- inode_total
+ monit_process
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- 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:
- Measurement:
- monit_directory
- Fields:
- permissions
- monit_remote_host
- tags:
- address
- version
- 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:
- Measurement:
- monit_file
- Fields:
- size
- permissions
+ monit_system
- tags:
- address
- version
- service
- 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:
- Measurement:
- monit_process
- Fields:
- cpu_percent
- cpu_percent_total
- mem_kb
- mem_kb_total
- mem_percent
- mem_percent_total
- pid
- parent_pid
- threads
- children
- monit_fifo
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
- permissions
Fields for Monit service type remote host:
- Measurement:
- monit_remote_host
- Fields:
- hostname
- port_number
- request
- protocol
- type
+ monit_program
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type system:
- Measurement:
- monit_system
- Fields:
- 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
- monit_network
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type fifo:
- Measurement:
- monit_fifo
- Fields:
- permissions
+ monit_program
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type program:
- Measurement:
- monit_program
- Fields:
- last_started_time
- program_status
- monit_network
- tags:
- address
- version
- service
- paltform_name
- status
- monitoring_status
- monitoring_mode
- fields:
- status_code
- monitoring_status_code
- monitoring_mode_code
Fields for Monit service type network:
- 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:
### Example Output
```
$ ./telegraf -config telegraf.conf -input-filter monit -test
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_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_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_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
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_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_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_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
```

View File

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