cannot change locale warning?

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sitaonair
Posts: 55
Joined: Wed Jan 06, 2016 3:36 am

cannot change locale warning?

Post by sitaonair »

Hi,

I have the same check running on 4 different servers and on 2 of the servers there is this setlocale warning shown below when running check_nrpe from Nagios:

[nagios@nagxi-01 ~]$ /usr/local/nagios/libexec/check_nrpe -H "HOST IP" -t 30 -c check_service
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US)
redis-server is running
Checking MySQL Proxy daemon... mysql-proxy is running.
cron is running.
Apache2 is running (pid 15753).
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US)
Axess Configurator up and running.
Axess management system (Zeo) is running.
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US)
collectd is running.
All services are running

Below is the output from running the check_service on the server itself:

[root@prd]# /usr/bin/sudo /usr/local/nagios/libexec/check_service.sh -o linux -t "/etc/init.d/axess_all_daemons status"
redis-server is running
Checking MySQL Proxy daemon... mysql-proxy is running.
cron is running.
Apache2 is running (pid 15753).
Axess Configurator up and running.
Axess management system (Zeo) is running.
collectd is running.
All services are running.


I have checked locale on both my Nagios XI and the remote host, both are showing same locale as below:

LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Any suggestions on where I can check for this issue? Thanks in advance
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: cannot change locale warning?

Post by lmiltchev »

How is the "check_service" command defined on the remote machine?

Can you run the command below logged in as nagios user, and show the output?

Code: Select all

su - nagios
/usr/bin/sudo /usr/local/nagios/libexec/check_service.sh -o linux -t "/etc/init.d/axess_all_daemons status"
Can you upload the "/etc/init.d/axess_all_daemons" file to the forum? What is the OS/architecture of the client machine?
Be sure to check out our Knowledgebase for helpful articles and solutions!
sitaonair
Posts: 55
Joined: Wed Jan 06, 2016 3:36 am

Re: cannot change locale warning?

Post by sitaonair »

nrpe.cfg:

command[check_service]=/usr/bin/sudo /usr/local/nagios/libexec/check_service.sh -o linux -t "/etc/init.d/axess_all_daemons status"

visudo:
nagios ALL=NOPASSWD: /usr/local/nagios/libexec/check_service.sh

command as nagios user on server:
[nagios@001 ~]$ /usr/bin/sudo /usr/local/nagios/libexec/check_service.sh -o linux -t "/etc/init.d/axess_all_daemons status"
redis-server is not running
cron is running.
Apache2 is running (pid 27093).
Axess Configurator up and running.
Axess management system (Zeo) is running.
collectd is running.

These services are running: mysql-proxy cron apache2 axess_configurator axess_zeo collectd.
These services are NOT running: redis-server ... failed!

client machine:
cat /etc/centos-release
CentOS release 6.9 (Final)

/etc/init.d/axess_all_daemons:
#!/bin/sh
# Startup script for the AXESS.ACS Server #
# chkconfig: - 85 15 #
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Start/stop ALL daemons for Axess ### END INIT INFO
PATH="$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
set -e
chroot /opt/production_axess /etc/init.d/axess_all_daemons $@
exit $?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: cannot change locale warning?

Post by lmiltchev »

In your script, you are changing the environment via chroot. That's why you are getting setlocale errors... Perhaps, you need to somehow set the locale inside your script in order to eliminate these errors. See if chrooting with LC_ALL=C would fix the issue for you.

https://serverfault.com/questions/35087 ... ith-chroot
Be sure to check out our Knowledgebase for helpful articles and solutions!
sitaonair
Posts: 55
Joined: Wed Jan 06, 2016 3:36 am

Re: cannot change locale warning?

Post by sitaonair »

sorry but how do I chroot with LC_ALL=C?
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: cannot change locale warning?

Post by lmiltchev »

To be honest, I am not sure and this is out of Nagios support scope, but you can try something like this in your script:

Code: Select all

chroot /opt/production_axess env LC_ALL=C /etc/init.d/axess_all_daemons $@
If this doesn't work, modify your script as such:

Code: Select all

#!/bin/sh
# Startup script for the AXESS.ACS Server #
# chkconfig: - 85 15 #
### BEGIN INIT INFO
# Provides:
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start:
# Default-Stop:
# Short-Description: Start/stop ALL daemons for Axess ### END INIT INFO
PATH="$PATH:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
set -e
LC_ALL=C
chroot /opt/production_axess /etc/init.d/axess_all_daemons $@
exit $?
Hope this helps.
Be sure to check out our Knowledgebase for helpful articles and solutions!
sitaonair
Posts: 55
Joined: Wed Jan 06, 2016 3:36 am

Re: cannot change locale warning?

Post by sitaonair »

Hi, the first one worked perfectly. Many thanks for helping though it is not a Nagios issue. Could you close this thread?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: cannot change locale warning?

Post by scottwilkerson »

sitaonair wrote:Hi, the first one worked perfectly. Many thanks for helping though it is not a Nagios issue. Could you close this thread?
Great

Closing
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked