Page 1 of 1
(No output on stdout) stderr: File "/usr/local/nagios/libexe
Posted: Tue Nov 09, 2021 9:26 am
by nagiosiqraa
Hi, I have initially installed Nagios XI on Ubuntu server A and installed linux-nrpe-agent on the client Machines and configured services and MongoDB to monitor.
Later the Ubuntu Server A got Damaged and reinstalled the Nagios XI on another Ubuntu server with a different IP. And the I changed the Ip in every linux-nrpe-agent using the steps:
Step 1. sudo nano /etc/xinetd.d/nrpe
In this file, only_from = 127.0.0.1 <Nagios XI new server IP>
Step 2. sudo service xinetd restart
In this way, I was able to connect the New Nagios XI with all the Linux-Nrpe-Agents.
But when I tried configuring MongoDB I'm getting this warning/error:
(No output on stdout) stderr: File "/usr/local/nagios/libexec/check_mongodb.py", line 57
I tried on multiple servers but on all the servers I'm getting the same issue. Then I tried uninstall one linux-nrpe-agent and re-installed it but still, the issue persists. So any suggestion on how to fix it?? (but on the initial installation with Ubuntu Server A it was working fine)
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Tue Nov 09, 2021 6:04 pm
by pbroste
Hello
@nagiosiqraa
Thanks for reaching out, let's verify some things from the command line:
Let's verify that you can see the open ports appropriate from your nagios server:
Code: Select all
yum or apt install nmap
nmap mongo.db.server.ip -pX
Where
mongo.db.server.ip is the IP address of your mongodb server and
X is the port number you use to auth against.
Run command to spin up help:
Code: Select all
cd /usr/local/nagios/libexec
./check_mongodb.py -h
Do you receive the help dialog. What if you pass it some variables to monitor your mongodb server? Use the help page to setup your check properly, below is just an example:
Code: Select all
./check_mongodb.py -H x.x.x.x -P port -u USER -p PASSWD
Code: Select all
/usr/local/nagios/libexec/check_mongodb.py -H x.x.x.x -u USER -p PASSWD -d DATABASE
Thanks,
Perry
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Tue Nov 09, 2021 11:43 pm
by nagiosiqraa
Hi Perry,
Thanks for the reply.
When I tried :
WhatsApp Image 2021-11-10 at 9.57.56 AM.jpeg
It was OK.
And next when I tried :
Code: Select all
cd /usr/local/nagios/libexec
./check_mongodb.py -h
I got an error:
WhatsApp Image 2021-11-10 at 10.01.00 AM.jpeg
when I tried this
Code: Select all
./check_mongodb.py -H x.x.x.x -P port -u USER -p PASSWD
I got the same error.
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Wed Nov 10, 2021 2:37 pm
by pbroste
Hello
@nagiosiraa
Thanks for following up, wanted to circle back and find out if you received similar results when using the MongoDB database configuration wizard?
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
Please let me know the results,
Perry
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Wed Nov 10, 2021 11:31 pm
by nagiosiqraa
Hi Perry,
I tried using the MongoDB database configuration wizard but got the same issue
Code: Select all
(No output on stdout) stderr: File "/usr/local/nagios/libexec/check_mongodb.py", line 57
except ImportError, e:
^
SyntaxError: invalid syntax
WhatsApp Image 2021-11-11 at 9.57.52 AM.jpeg
PS: I think other services doesn't have any issues
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Thu Nov 11, 2021 3:03 pm
by pbroste
Hello
@nagiosiqraa
Thanks for following up, I have spun up a test environment and I am receiving the same error message and will be working through this and will let you know what I find.
Looking at the 'check_mongodb' script we see that it is using '
#!/usr/bin/env python3.6'.
On your Nagios XI server environment let's check on python:
and also a list:
Please let us know what you get on these.
Thanks,
Perry
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Fri Nov 12, 2021 12:00 am
by nagiosiqraa
Hi Perry,
Thanks for following up on the issue.
The output you asked for.
WhatsApp Image 2021-11-12 at 9.51.22 AM.jpeg
Somehow I have found a way to fix the issue but I'm not sure whether is it the right way or not. While I was going through the check_mongodb.py file I found that it was using python 2 syntax (for example in the print statement, except and all) So what I did is I replaced the content of check_mongodb.py with python3 which I found in this:
https://github.com/mzupan/nagios-plugin ... mongodb.py
Now it's working I am able to monitor MongoDB Servers but I'm sure is the right way or not, will it have some other impacts Can you confirm?
For Your reference, I will add both files.
1. The original check_mongodb.py (which has the issue):
check_mongodb.py
2. The check_mongodb.py that I replaced:
check_mongodb.py
Re: (No output on stdout) stderr: File "/usr/local/nagios/li
Posted: Fri Nov 12, 2021 12:02 pm
by pbroste
Hello
@nagiosiqraa
I was looking over the 'check_mongodb.py' last night and noticed that as well. Even though it specifies python3 environment it is referencing python2 code.
Please let us know if there is anything further, otherwise you are good to go,
Perry