Giter VIP home page Giter VIP logo

nagios-mattermost's People

Contributors

absk1317 avatar andrefreitas avatar joshaidan avatar nunodio avatar ralish avatar revol avatar trances avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

nagios-mattermost's Issues

matermost.py with HTTPS webhook URL

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

I have the below issue when trying to notify my channel.

Please let me know if you need further information. Thank you.

VERSIONS:
python -c "import sys;print sys.executable; import urllib2; print urllib2.__version__" /usr/bin/python 2.7

ERROR:
[1555410523] wproc: NOTIFY job 74314 from worker Core Worker 27615 is a non-check helper but exited with return code 1 [1555410523] wproc: host=pr-glb-gal-leo-db-01; service=DB Files; contact=mattermost [1555410523] wproc: early_timeout=0; exited_ok=1; wait_status=256; error_code=0; [1555410523] wproc: stderr line 01: Traceback (most recent call last): [1555410523] wproc: stderr line 02: File "/usr/local/nagios/libexec/mattermost.py", line 108, in <module> [1555410523] wproc: stderr line 03: response = request(args.url, payload(args)) [1555410523] wproc: stderr line 04: File "/usr/local/nagios/libexec/mattermost.py", line 102, in request [1555410523] wproc: stderr line 05: response = urllib2.urlopen(req) [1555410523] wproc: stderr line 06: File "/usr/lib/python2.7/urllib2.py", line 154, in urlopen [1555410523] wproc: stderr line 07: return opener.open(url, data, timeout) [1555410523] wproc: stderr line 08: File "/usr/lib/python2.7/urllib2.py", line 431, in open [1555410523] wproc: stderr line 09: response = self._open(req, data) [1555410523] wproc: stderr line 10: File "/usr/lib/python2.7/urllib2.py", line 454, in _open [1555410523] wproc: stderr line 11: 'unknown_open', req) [1555410523] wproc: stderr line 12: File "/usr/lib/python2.7/urllib2.py", line 409, in _call_chain [1555410523] wproc: stderr line 13: result = func(*args) [1555410523] wproc: stderr line 14: File "/usr/lib/python2.7/urllib2.py", line 1265, in unknown_open [1555410523] wproc: stderr line 15: raise URLError('unknown url type: %s' % type) [1555410523] wproc: stderr line 16: urllib2.URLError: <urlopen error unknown url type: [http>

Mattermost moving to API version 4

Hey @andrefreitas @hugopeixoto and others!

First, hugely appreciate you sharing this project back with the world. Fantastic work!

I wanted to let you know about our plans moving to API v4:

To make the Mattermost API web service easier to use and to offer more powerful options for these integrations, Mattermost will be moving to a new API version soon. Highlights include:

  • Fully documented API endpoints
  • More in-depth access to server functionality
  • Wider use of established HTTP verbs
  • Consistent endpoint structures
  • A new and improved Go driver

We plan to release API version 4 on March 16th, with Mattermost server 3.7. While the current API version 3 will be supported until September 16th, we recommend you begin using API version 4 soon after its release.

Contributing

API version 4 is an active and on-going project. If you're interested in helping contribute, please join our Mattermost community instance and the APIv4 channel.

We've prepared a contribution process for APIv4 and a progress tracker for new APIv4 enpoints to help you get started.

We're also open for suggestions on adding new API endpoints to help with your integration.

Add an open source license

Thanks for sharing this project! We have earlier added your integration in the Mattermost App Directory.

Would you consider adding a license, such as a MIT or an Apache 2.0 license?

To do so, in GitHub you can click "Create new file" and name a file LICENSE.txt.
This will prompt GitHub to offer a license template.

If you use a license it would make it easy to add your work to other open source projects, and we'd love to include your work in ours.

Thanks kindly for your consideration and let me know if you have any questions!

notifications fail when output ends with semicolon (;)

[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
# 

Support python3

    import urllib2
ModuleNotFoundError: No module named 'urllib2'

Url + channel

Thanks for this !!

How you define the url where Mattermost is located and the channel to notify the alerts?

Thanks ;)

Script Execution Issues

hi @andrefreitas ,

thanks for your script anyway.

kindly need your suggestion.
im quite struggling with your script.
i try by execute :

python matternag.py --url http://chat.abc.io/abc/channels/trial- --hostalias server1 --notificationtype Problem --serviceoutput "Service Apache Down!"

the last line output are :
`
<script>
window.setup_login_page({"TeamDisplayName":"abc","TeamName":"abc","Title":"abc-group Chat Line - Login"});
</script>

`

since our mattermost server are working well, is there anything else i need to do ?
do i need to put my username and password inside the script ?

looking forward for your information.

many thanks

cheers,
henry

NDrive/nagios-mattermost plugin installation on Ubuntu

Hi,
I am running Nagios and Mattermost on Ubuntu 14.04 and i am new to Ubuntu. Can you guys please help me to integrate Nagios with MM.?
I am successful on enabling webhook URL in MM. However i am facing difficulties on NDrive/nagios-mattermost plugin installation with Nagios. So Please provide me the detailed steps on plugin installation.

Appreciate your responses.

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.