Hi,
I am getting NRPE: Unable to read output when trying to connect to the docker container using nagios.
When i run this script directly on the client machine it is successfully returning me the number of rows in mongo db. But when i run it remotely from the server i am getting unable to read output.
executing from nagios server
/usr/lib64/nagios/plugins/check_nrpe -H hostipaddress -c check_mongocount
NRPE: Unable to read output
check_mongocount script is basically conneccting to the docker container and counting the number of rows for a particular customer for a date
count=`sudo /bin/docker exec -it container mongo dbname --quiet -u "test" -p "test" --authenticationDatabase "test" --eval '(db.test.count( { $and: [{create_at: {$gte: NumberLong("1499227200"), $lt: NumberLong("1499313599")}},{customerid:1}]}))'
/etc/nagios/nrpe.cfg has the following line added.
command[check_mongocount]=sudo /usr/lib64/nagios/plugins/test.sh
i have nrpe ALL=(ALL) NOPASSWD:ALL in my /etc/sudoers file.
getting NRPE: Unable to read output when running from server
-
- Posts: 3
- Joined: Fri May 19, 2017 10:54 am
-
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: getting NRPE: Unable to read output when running from se
Is NRPE running as the user nrpe in your docker container?
Is it using the standard port?
To verify you can make a basic connection can you run the following and get back the version?
Is it using the standard port?
To verify you can make a basic connection can you run the following and get back the version?
Code: Select all
/usr/lib64/nagios/plugins/check_nrpe -H hostipaddress
-
- Posts: 3
- Joined: Fri May 19, 2017 10:54 am
Re: getting NRPE: Unable to read output when running from se
Thanks for your reply scott. My issue is resolved just now.
the only change i did was removing the -it in the below command.
count=`sudo /bin/docker exec -it container mongo dbname --quiet -u "test" -p "test" --authenticationDatabase "test" --eval '(db.test.count( { $and: [{create_at: {$gte: NumberLong("1499227200"), $lt: NumberLong("1499313599")}},{customerid:1}]}))'
the only change i did was removing the -it in the below command.
count=`sudo /bin/docker exec -it container mongo dbname --quiet -u "test" -p "test" --authenticationDatabase "test" --eval '(db.test.count( { $and: [{create_at: {$gte: NumberLong("1499227200"), $lt: NumberLong("1499313599")}},{customerid:1}]}))'
Re: getting NRPE: Unable to read output when running from se
I am glad your issue has been resolved! I am closing the topic now. If you have any more questions/issues, please start a new thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!