nagios-herald Install and config - monitoring

I tried to install nagios-herald on my test VM.
I tried to configure herald to send emails. When I tried to send mail via command, It's working but not able to fetch/send with the proper formatted.
Below are commands for your reference.
[root#localhost ~]# /usr/local/nagios-herald/bin/nagios-herald --env-file /usr/local/nagios-herald/test/env_files/nagios_vars.EXAMPLE --formatter=check_ping -r amit#example.com -y nagios#example.com --message-type email -u http://192.168.124.25 --trace
Please anyone suggest me for configuration of nagios-herald with Nagios.

Just a quick tip, dont forget to set the following in nagios.cfg:
enable_environment_macros=1
Also, here is mine commands.cfg:
define command {
command_name notify-host-by-email
command_line /usr/local/nagios-herald/bin/nagios-herald --message-type email -r $CONTACTEMAIL$ --formatter=$_HOSTMESSAGE_FORMATTER_NAME$ --nagios-cgi-url=http://192.168.0.1/nagios/cgi-bin/cmd.cgi --reply-to=nagios#somehost
}
define command {
command_name notify-service-by-email
command_line /usr/local/nagios-herald/bin/nagios-herald --message-type email -r $CONTACTEMAIL$ --formatter=$_SERVICEMESSAGE_FORMATTER_NAME$ --nagios-cgi-url=http://192.168.0.1/nagios/cgi-bin/cmd.cgi --reply-to=nagios#somehost
}
After this you should have it working.
Good luck.

There is no check_ping formatter in the default project. If you've written one and it lives outside of the project directory, you can teach nagios-herald how to find it with -F </path/to/custom/formatters>.
I also noticed you are using the --trace option. If you specify either -l <logfile> in the command or logfile: in the config, you'll see what issues nagios-herald is encountering. I'm betting you'll see it state that it can't locate the check_ping formatter and fell back to the base formatter.

Related

How to edit permissions on Heroku application?

My problem in simple terms is that I have an executable that can't be run on Heroku, because it doesn't have the right permissions.
In more details, I have a RoR application on Heroku and I want to use server pdftk. But after installing it I need to chmod the file to be able to use it. And if I run a console on Heroku dashboard, put the chmod command in and try running pdftk it works, but it works just for that temporary dyno and it doesn't work on production server.
I tried creating .profile and putting the command in and that didn't work.
I tried creating Procfile and put release: chmod u+x /app/vendor/pdftk/bin/pdftk and it didn't work.
I tried all different versions of release, web, worker...
I tried creating a .sh file and putting the command in there and then running the file and it doesn't work either.
command for setting permission: chmod u+x /app/vendor/pdftk/bin/pdftk
If you need more info, please tell me.
Any help would be appreciated.
Okay, I figured out what the problem was.
I have a pipeline from gitlab and the permissions just needed to be set through git, so that they were correct when they came to the production enviroment.
I needed to run this code:git update-index --add --chmod=+x pdftk

Why readline does not unset `backward-delete-char`?

I need to bind the code 127 (aka DEL, aka ^?) to delete-char.
If I put DEL: delete-char to ~/.inputrc, it does not work. This is because this code is used by backward-delete-char by default.
So, first I need to free this code from backward-delete-char:
$ bind -u backward-delete-char
But for some reason it is not unset:
$ bind -q backward-delete-char
backward-delete-char can be invoked via "\C-?".
What should be changed in source code of readline library (for local use) to unbind the \C-? from backward-delete-char?
N.B. If I unset for example delete-char, it works flawlessly:
$ bind -u delete-char
$ bind -q delete-char
delete-char is not bound to any keys.
Running GNU bash, version 4.4.19(1)-release (x86_64-apple-darwin16.6.0) I see the same thing. I am able to unset the one I wanted with this: bind -m emacs-meta -u backward-kill-word
According to the maintainer Chet:
Unless you use the -m' option, the commands act on the current keymap, which is eitheremacs' or (usually) `vi-insert'
I found that his example commands didn't quite work, and only -m emacs-meta worked - but I'm not sure how to discover precisely which keymap applies.
Discovery process: searched the mailing list (Googled and site:http://lists.gnu.org/archive/html/bug-bash/ "bind -u") and picked up:
Re: Some readline functions can't be unbound with bind -u

Could not login with bash shell by default

I want to run a Ruby on Rails application. When I tried to run it, it shows me this,
The program 'rails' is currently not installed. You can install it by typing:
sudo apt install ruby-railties
So, I figured out the problem and I found that the problem is due to not login into bash shell. My terminal could not execute 'ruby' or 'ruby on rails' scripts. I checked .bashrc and .bash_profile files if PATH variable is set to point to rvm file.
When I did,
/bash/bin -l
it shows me ruby or rails are installed on system and I could start Rails server successfully. But if I opened another Terminal window, same problem occurs. Basically, I want to log into bash shell by default. Please correct and help me to sort out this. Thanks!
If you are sure the location of your bash shell is /bin/bash you could use this command (replacing "username" with your username):
chsh -s /bin/bash username
That will change your default shell in most unix like operating systems.
Afterwards you can verify it checking /etc/passwd where you will see the default shell at the end of the line of your username.
Warning: Try it first with a new user, in order to avoid losing your shell access if the path to bash is different :-)

/dev/ttyUSB1 cannot be changed in SLIP using Contiki OS with MICAz platform

I have a problem when using the SLIP in Contiki. The port only can be changed to /dev/ttyUSB1 in /contiki/tools directory with the command sudo ./tunslip6 -s /dev/ttyUSB1 aaaa::1/64 -v6
However, when I want to make a connection at /contiki/examples/ipv6/rpl-border-router directory, with the command make connect-router, it will then change back to /dev/ttyUSB0
May I know what is the problem?
Thank you.
The command make executes the recipes contained in the file Makefile. If you look within that (in your example folder) you will find the recipe calling tunslip:
connect-router-cooja: $(CONTIKI)/tools/tunslip6
sudo $(CONTIKI)/tools/tunslip6 -a 127.0.0.1 $(PREFIX)
you can change the command there and add -s /dev/ttyUSB1.

Trying to set up bash command

I was trying to set up a bash command in Terminal on a Mac.
The scripts run correctly when I execute them directly.
I set up symlinks in /usr/local/bin/ to the current location of the scripts. When I try to run it off the symlink, it doesn't work. I don't believe the issue is the $PATH, because pip, git, ipython all exist in this location. When I edit the $PATH setting, these fail.
Suggestions?
ls -l /usr/local/bin/foo and see where your symlink is actually pointing. Betcha it's broken.
If not, try running /usr/local/bin/foo. If that works, it was your PATH that's wrong, despite what you said in the OP.
The only other thing that would cause this behavior is if the script is reading $0 (its own name as executed). With a symlink, that will have a different value.
I found my own answer... The symlinks were created by an automated file which was gabbing my pwd. I was also using virtualenv, so to get it to work, I had to activate the virtualenv and be inside the folder that had the script that created the symlinks.
I install my commands in $HOME/bin instead of /usr/local/bin, but it does not matter much. As hinted in the comments, one question is whether the symlinks are set correctly.
Check which command the shell thinks you should execute: which command
Check that the link in /usr/local/bin points to the correct file (and has execute permission, etc):
ls -l /usr/local/bin/command
ls -lL /usr/local/bin/command
Check that the interpreter path in the shebang is correct:
file /usr/local/bin/command
Check that /usr/local/bin is actually on your PATH: echo $PATH
If none of that shows up a problem, show us the results of the commands above.

Resources