Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/collectors/MonitCollector.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ measure_collector_time | False | Collect the collector run time in ms | bool
metrics_blacklist | None | Regex to match metrics to block. Mutually exclusive with metrics_whitelist | NoneType
metrics_whitelist | None | Regex to match metrics to transmit. Mutually exclusive with metrics_blacklist | NoneType
send_totals | False | Send cpu and memory totals | bool
scheme | http | Select scheme http or https | str
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alphabetize

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The descriptions need to be added to the get_default_config_help method in the collector file since this doc is actually generated from that.

selfsigned | False | Use self-signed certificate | bool

#### Example Output

Expand All @@ -46,4 +48,3 @@ servers.hostname.monit.rsyslogd.memory.kilobyte_usage 2664
servers.hostname.monit.sshd.cpu.percent 0.0
servers.hostname.monit.sshd.memory.kilobyte_usage 2588
```

14 changes: 12 additions & 2 deletions src/collectors/monit/monit.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import urllib2
import base64
import sys
import ssl

from xml.dom.minidom import parseString

Expand Down Expand Up @@ -40,12 +42,20 @@ def get_default_config(self):
'path': 'monit',
'byte_unit': ['byte'],
'send_totals': False,
'scheme': 'http',
'selfsigned': False,
})
return config

def collect(self):
url = 'http://%s:%i/_status?format=xml' % (self.config['host'],
int(self.config['port']))
url = '%s://%s:%i/_status?format=xml' % (self.config['scheme'],
self.config['host'],
int(self.config['port']))

# 0x020709f0 exactly equal python 2.7.9 final
if (self.config['selfsigned'] and sys.hexversion >= 0x020709f0 and hasattr(ssl, '_create_unverified_context')):
ssl._create_default_https_context = ssl._create_unverified_context

try:
request = urllib2.Request(url)

Expand Down