getting NRPE: Unable to read output when running from server

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
putharekulu
Posts: 3
Joined: Fri May 19, 2017 10:54 am

getting NRPE: Unable to read output when running from server

Post by putharekulu »

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.
scottwilkerson
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

Post by scottwilkerson »

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?

Code: Select all

/usr/lib64/nagios/plugins/check_nrpe -H hostipaddress
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
putharekulu
Posts: 3
Joined: Fri May 19, 2017 10:54 am

Re: getting NRPE: Unable to read output when running from se

Post by putharekulu »

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}]}))'
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: getting NRPE: Unable to read output when running from se

Post by lmiltchev »

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!
Locked