Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

notifications fail when output ends with semicolon (;) #13

Open
apagr opened this issue Nov 13, 2017 · 1 comment
Open

notifications fail when output ends with semicolon (;) #13

apagr opened this issue Nov 13, 2017 · 1 comment

Comments

@apagr
Copy link

apagr commented Nov 13, 2017

[2017-11-13 06:31:33 +0100] warning/PluginNotificationTask: Notification command for object 'blahblahhostname!disk /mnt/backup' (PID: 24573, arguments: '/usr/lib/nagios/plugins/mattermost.py' '--channel' 'monit' '--hostalias' 'blahblahhostname' '--notificationtype' 'PROBLEM' '--servicedesc' 'disk /mnt/backup' '--serviceoutput' 'DISK CRITICAL - free space: /mnt/backup 41212 MB (3% inode=-)];' '--servicestate' 'CRITICAL' '--url' '(valid webhook)') terminated with exit code 1, output: Traceback (most recent call last):
File "/usr/lib/nagios/plugins/mattermost.py", line 107, in
response = request(args.url, payload(args))
File "/usr/lib/nagios/plugins/mattermost.py", line 101, 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 437, in open
response = meth(req, response)
File "/usr/lib/python2.7/urllib2.py", line 550, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python2.7/urllib2.py", line 475, in error
return self._call_chain(*args)
File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain
result = func(*args)
File "/usr/lib/python2.7/urllib2.py", line 558, in http_error_default
raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 400: Bad Request

works after removing semicolon of output.

standard plugin output below:

# /usr/lib/nagios/plugins/check_disk /home
DISK OK - free space: / 937211 MB (53% inode=96%);| /=798526MB;;;0;1828650
# 
@jpmens
Copy link

jpmens commented Dec 8, 2018

We noticed a problem with semicolons as well, but I cannot confirm it happens only when they're at the end of a line. I solved it with this trivial patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants