Wrong output showing in nagios console

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Wrong output showing in nagios console

Post by dchurch »

Something didn't get executed right, please run again using "bash -x":

Code: Select all

su - nagios
bash -x /usr/local/nagios/libexec/check_rmq_cluster.sh
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
informatica
Posts: 99
Joined: Thu Jan 28, 2021 9:55 pm

Re: Wrong output showing in nagios console

Post by informatica »

Hi team.
Please find the below logs.

[nagios@asvrhmorphapp1 libexec]$ bash -x ./check_rmq_cluster.sh
+ source /opt/morpheus/embedded/rabbitmq/.profile
++ export LANG=en_US.UTF-8
++ LANG=en_US.UTF-8
++ export LC_ALL=en_US.UTF-8
++ LC_ALL=en_US.UTF-8
++ export HOME=/opt/morpheus/embedded/rabbitmq
++ HOME=/opt/morpheus/embedded/rabbitmq
++ export PATH=/opt/morpheus/bin:/opt/morpheus/embedded/bin:/opt/morpheus/embedded/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
++ PATH=/opt/morpheus/bin:/opt/morpheus/embedded/bin:/opt/morpheus/embedded/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
++ export ERL_EPMD_ADDRESS=0.0.0.0
++ ERL_EPMD_ADDRESS=0.0.0.0
++ export RABBITMQ_CONF_ENV_FILE=/opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf
++ RABBITMQ_CONF_ENV_FILE=/opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf
++ . /opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf
/opt/morpheus/embedded/rabbitmq/.profile: line 7: /opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf: Permission denied
+++ cut -d= -f1 /opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf
cut: /opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf: Permission denied
++ export
declare -x ERL_EPMD_ADDRESS="0.0.0.0"
declare -x GROUP="users"
declare -x HISTCONTROL="ignoredups"
declare -x HISTSIZE="1000"
declare -x HOME="/opt/morpheus/embedded/rabbitmq"
declare -x HOST="asvrhmorphapp1.informatica.com"
declare -x HOSTNAME="asvrhmorphapp1.informatica.com"
declare -x HOSTTYPE="x86_64-linux"
declare -x HOST_EXTERNAL="asvrhmorphapp1"
declare -x HOST_INTERNAL="container13970"
declare -x INSTANCE_HOSTNAME="asvrhmorphapp1"
declare -x IP_INTERNAL="10.21.146.121"
declare -x IP_PUBLIC="10.21.146.121"
declare -x LANG="en_US.UTF-8"
declare -x LC_ALL="en_US.UTF-8"
declare -x LESSOPEN="||/usr/bin/lesspipe.sh %s"
declare -x LOGNAME="nagios"
declare -x LS_COLORS="rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:"
declare -x MACHTYPE="x86_64"
declare -x MAIL="/var/spool/mail/nagios"
declare -x OLDPWD
declare -x OSTYPE="linux"
declare -x PATH="/opt/morpheus/bin:/opt/morpheus/embedded/bin:/opt/morpheus/embedded/sbin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin"
declare -x PWD="/usr/local/nagios/libexec"
declare -x RABBITMQ_CONF_ENV_FILE="/opt/morpheus/embedded/rabbitmq/etc/rabbitmq-env.conf"
declare -x REMOTEHOST="10.65.53.30"
declare -x SHELL="/bin/csh"
declare -x SHLVL="3"
declare -x SSH_CLIENT="10.65.53.30 57217 22"
declare -x SSH_CONNECTION="10.65.53.30 57217 10.21.146.121 22"
declare -x SSH_TTY="/dev/pts/1"
declare -x TERM="xterm"
declare -x USER="nagios"
declare -x VENDOR="unknown"
declare -x XDG_RUNTIME_DIR="/run/user/0"
declare -x XDG_SESSION_ID="30139"
++ /opt/morpheus/embedded/bin/rabbitmqctl cluster_status
++ grep 'Running Nodes' -A 5
++ grep @
++ wc -l

05:49:14.060 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:15.017 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:15.018 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:15.959 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:15.960 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:16.907 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:16.909 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:17.849 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:17.850 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:18.802 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:18.803 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:19.744 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:19.746 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:20.727 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:20.729 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:21.732 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:21.734 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:22.685 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:22.688 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces

05:49:23.645 [error] Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces
Distribution failed: {{:shutdown, {:failed_to_start_child, :auth, {'Error when reading /opt/morpheus/embedded/rabbitmq/.erlang.cookie: eacces', [{:auth, :init_cookie, 0, [file: 'auth.erl', line: 286]}, {:auth, :init, 1, [file: 'auth.erl', line: 140]}, {:gen_server, :init_it, 2, [file: 'gen_server.erl', line: 374]}, {:gen_server, :init_it, 6, [file: 'gen_server.erl', line: 342]}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}}}, {:child, :undefined, :net_sup_dynamic, {:erl_distribution, :start_link, [[:"rabbitmqcli-8664-rabbit@asvrhmorphapp1", :shortnames, 15000], false]}, :permanent, 1000, :supervisor, [:erl_distribution]}}
+ node_count=0
+ echo 0
0
+ case $node_count in
[nagios@asvrhmorphapp1 libexec]$
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Wrong output showing in nagios console

Post by dchurch »

What's the output from the following command?

Code: Select all

ls -la /opt/morpheus/embedded/rabbitmq/etc/
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
informatica
Posts: 99
Joined: Thu Jan 28, 2021 9:55 pm

Re: Wrong output showing in nagios console

Post by informatica »

Hi Team,

Please find the below update.

[root@asvrhmorphapp1 ~]# ls -la /opt/morpheus/embedded/rabbitmq/etc/
total 16
drwxr-x--- 2 rabbitmq-morpheus rabbitmq-morpheus 75 Jan 11 17:12 .
drwxr-xr-x 7 rabbitmq-morpheus rabbitmq-morpheus 4096 Feb 19 09:14 ..
-rw-r--r-- 1 root root 58 Jan 11 17:12 enabled_plugins
-rw-r--r-- 1 root root 154 Oct 23 18:16 rabbit.config
-rw-r--r-- 1 root root 664 Oct 23 18:16 rabbitmq-env.conf
dchurch
Posts: 858
Joined: Wed Oct 07, 2020 12:46 pm
Location: Yo mama

Re: Wrong output showing in nagios console

Post by dchurch »

Okay, I have a pretty clear picture of what's going on. The check_rmq_cluster.sh script has a bug in it where it tries to read from the config file, and can't and inserts an empty string on the command line so instead of running "export FOO=bar", it just runs "export" which triggers the variable listing you're seeing.

I suggest getting in contact with the authors of the script to fix it. Since I can't seem to find who wrote it on Google, that'll be up to you.

In the mean time here are a couple of things you can do to remedy your situation:

Option 0:

Change "command[check_rmq_cluster]=/usr/local/nagios/libexec/check_rmq_cluster.sh" to

Code: Select all

command[check_rmq_cluster]=sudo -u rabbitmq-morpheus /usr/local/nagios/libexec/check_rmq_cluster.sh

Option 1:

Run this command:

Code: Select all

chmod 0755 /opt/morpheus/embedded/rabbitmq/etc/
If you didn't get an 8% raise over the course of the pandemic, you took a pay cut.

Discussion of wages is protected speech under the National Labor Relations Act, and no employer can tell you you can't disclose your pay with your fellow employees.
Locked