- removed unused copy module - suffix '/_status?format=xml&level=full' now added by default - url instead of host+port in config (+readme.md update)
- removed unused copy module - suffix '/_status?format=xml&level=full' now added by default - url instead of host+port in config (+readme.md update)
Evgeniy Kostenko committed
Aug 5, 2018 at 16:07 UTC
6e023743d5154cc0a21a03d537a1ca7b77f03ab3
2 files changed
+5
-6
python.d/README.md
+2
-3
@@ -1406,13 +1406,12 @@ Sample:
1406
```yaml
1407
local:
1408
name : 'local'
1409
- host : '127.0.0.1'
1410
- port : 2812
1409
+ url : 'http://localhost:2812'
1410
user: : admin
1411
pass: : monit
1412
```
1413
1415
-If no configuration is given, module will attempt to connect to monit as `http://localhost:2812/_status?format=xml&level=full`.
1414
+If no configuration is given, module will attempt to connect to monit as `http://localhost:2812`.
1415
1416
---
1417
python.d/monit.chart.py
+3
-3
@@ -3,7 +3,6 @@
3
# Author: Evgeniy K. (n0guest)
4
# SPDX-License-Identifier: GPL-3.0+
5
6
-import copy
6
import xml.etree.ElementTree as ET
7
from bases.FrameworkServices.UrlService import UrlService
8
@@ -77,7 +76,8 @@ CHARTS = {
76
class Service(UrlService):
77
def __init__(self, configuration=None, name=None):
78
UrlService.__init__(self, configuration=configuration, name=name)
80
- self.url = self.configuration.get('url', "http://localhost:2812/_status?format=xml&level=full")
79
+ base_url = self.configuration.get('url', 'http://localhost:2812')
80
+ self.url = '{0}/_status?format=xml&level=full'.format(base_url)
81
self.order = ORDER
82
self.definitions = CHARTS
83
@@ -85,7 +85,7 @@ class Service(UrlService):
85
try:
86
xml = ET.fromstring(data)
87
except ET.ParseError:
88
- self.debug('{0} is not a vaild XML page. Please add "_status?format=xml&level=full" to monit URL.'.format(self.url))
88
+ self.error("URL {0} didn't return a vaild XML page. Please check your settings.".format(self.url))
89
return None
90
return xml
91