Comments (7)
Looks like the definition above Line 10 is broken, does it have a closing curly bracket?
from nagios-slack-notifications.
No, when it threw the error, I moved the "define command" statement to the beginning of the nagios.cfg file, and it still gives the error. If I comment the two "define command" statements out, it works fine. I was thinking that maybe the syntax has changed.
define command {
command_name notify-host-slack-opintel
command_line /bin/bash /etc/nagios3/notification_slack.sh -a "$NOTIFICATIONTYPE$" -b "$HOSTNAME$" -c "$HOSTSTATE$" -d "$HOSTOUTPUT$" -y "opintel" -z "https://hooks.slack.com/services/lotsofgobblygoop"
}
I would appreciate any guidance you can give. Thanks!
from nagios-slack-notifications.
Hm...
Just as a note, the webhook address shouldn't include the URL: https://hooks.slack.com/services/
It should just be the code: e.g - T07B2S2CC/B1HDDQ83A/naizPgXARIlUSixE0RUL93Oy
Also, can you run
/usr/local/nagios/bin/nagios -v /etc/nagios3/nagios.cfg
(You may have to modify the command to match your path)
If you don't mind, post the output here and I'll take a look (feel free to comment out anything confidential). This script is currently working in production elsewhere on Nagios3 so hopefully we can work it out.
from nagios-slack-notifications.
As an aside, if you want to test the script without Nagios you can run
/bin/bash /etc/nagios3/notification_slack.sh -a "WARNING" -b "test.domain.com" -c "DOWN" -d "This is a test" -y "opintel" -z "T07B2S2CC/B1HDDQ83A/naizPgXARIlUSixE0RUL93Oy"
directly in the command line - replacing the webhook code for your own. This will at least confrm that the script will work when you get the Nagios side sorted.
from nagios-slack-notifications.
Thanks for the above test. I was able to run it and alert Slack. However, the following syntax:
define command {
command_name notify-host-slack-opintel
command_line /bin/bash /etc/nagios3/notification_slack.sh -a "$NOTIFICATIONTYPE$" -b "$HOSTNAME$" -c "$HOSTSTATE$" -d "$HOSTOUTPUT$" -y "opintel" -z "T03AD0X2H/B8JCJ6M2A/SlIK8yEb6xobfuscated"
}
still results in an error. I'm on Devuan, which is Debian minus systemd. I ran:
/usr/sbin/nagios3 -v /etc/nagios3/nagios.cfg
which resulted in:
Nagios Core 3.5.1
Copyright (c) 2009-2011 Nagios Core Development Team and Community Contributors
Copyright (c) 1999-2009 Ethan Galstad
Last Modified: 08-30-2013
License: GPL
Website: http://www.nagios.org
Reading configuration data...
Error in configuration file '/etc/nagios3/nagios.cfg' - Line 1306 (NULL value)
Error processing main config file!
***> One or more problems was encountered while processing the config files...
Check your configuration file(s) to ensure that they contain valid
directives and data defintions. If you are upgrading from a previous
version of Nagios, you should be aware that some variables/definitions
may have been removed or modified in this version. Make sure to read
the HTML documentation regarding the config files, as well as the
'Whats New' section to find out what has changed.
Line 1306 is the define command
statement that is listed above. It just doesn't like that syntax for some reason. I'm sure I must be doing something wrong. Thanks for all of your assistance.
from nagios-slack-notifications.
So it turns out this was a misunderstanding on my part. The define command
statement for the version of nagios I'm running has to be in /etc/nagios3/commands.cfg
. If you put it in the /etc/nagios3/nagios.cfg
file, it will error out on you every time. My apologies for wasting your time. It's been many years since I've stood up a nagios server. Thanks again for all of your help.
from nagios-slack-notifications.
Ah of course, I didn't have a Nagios setup to look at anymore these days (this tool was written for an old client) and I was trying to remember the way it's configured. You're right, nagios.cfg is a different syntax than the command / host / service definitions.
Not a waste of time at all, your feedback has made it clear I need to improve the documentation so thank you for that.
from nagios-slack-notifications.
Related Issues (2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nagios-slack-notifications.