-
Notifications
You must be signed in to change notification settings - Fork 36
matermost.py with HTTPS webhook URL #19
Description
Hello guys,
- I've migrated my mattermost server to HTTPS (with certificate, conf OP and working). But my Nagios notifications are down for this reason :
./mattermost.py --url https://mattermostserver.local:8065/hooks/3wjtktky7jgk8gp6wtgmx5apay --username Nagios --iconurl http://mattermostserver.local/nagios.png --notificationtype PROBLEM --hostalias myserver --hostaddress 10.10.10.10 --hoststate DOWN
Returns that (not working) :
Traceback (most recent call last): File "./mattermost.py", line 100, in <module> response = request(args.url, data) File "./mattermost.py", line 93, in request response = urllib2.urlopen(req) File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/usr/lib/python2.7/urllib2.py", line 429, in open response = self._open(req, data) File "/usr/lib/python2.7/urllib2.py", line 447, in _open '_open', req) File "/usr/lib/python2.7/urllib2.py", line 407, in _call_chain result = func(*args) File "/usr/lib/python2.7/urllib2.py", line 1241, in https_open context=self._context) File "/usr/lib/python2.7/urllib2.py", line 1198, in do_open raise URLError(err) urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>
- The same, with curl command works (but with an --insecure after the webhook URL) :
/usr/bin/curl -i -X POST -d 'payload={"icon_url": "mattermostserver.local/nagios.png", "username": "Nagios", "text": "$NOTIFICATIONTYPE$ $HOSTNAME$ $HOSTADDRESS$ $HOSTSTATE$ $HOSTOUTPUT$"}' https://mattermostserver.local:8065/hooks/3wjtktky7jgk8gp6wtgmx5apay --insecure
Returns that (working) :
HTTP/1.1 200 OK Content-Type: text/plain X-Request-Id: nq4uub5cm3yeif19h6x1u9539c X-Version-Id: 5.15.0.5.15.0.ebede62880690e623d77fb106dea2ce3.false Date: Thu, 31 Oct 2019 13:45:13 GMT Content-Length: 2
I read that using HTTPS trought proxy with urllib2 may cause issues... But my nagios server and my mattermost server are on the same subnet (no proxy conf).
Regards,
Tom