ambari-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pawel Akonom <pawel.ako...@vnomic.com>
Subject Re: Grafana service can't start because of missing config file
Date Thu, 16 Jun 2016 15:32:11 GMT
Hi Aravidan,


The problem is not about cd to "/usr/lib/ambari-metrics-grafana/" before running the command.


"/usr/sbin/ambari-metrics-grafana start" script is actually doing it. In bash debug mode:


[root@hdp-vora-slave ambari-metrics-grafana]# su - ams -c 'bash -x /usr/sbin/ambari-metrics-grafana
start'
+ PATH=/bin:/usr/bin:/sbin:/usr/sbin
+ NAME=grafana-server
+ DESC='Ambari Metrics Grafana'
+ CONF_DIR=/etc/ambari-metrics-grafana/conf
+ [[ -f /etc/ambari-metrics-grafana/conf/ams-grafana-env.sh ]]
+ . /etc/ambari-metrics-grafana/conf/ams-grafana-env.sh
++ export AMS_GRAFANA_HOME_DIR=/usr/lib/ambari-metrics-grafana
++ AMS_GRAFANA_HOME_DIR=/usr/lib/ambari-metrics-grafana
++ export AMS_GRAFANA_DATA_DIR=/var/lib/ambari-metrics-grafana
++ AMS_GRAFANA_DATA_DIR=/var/lib/ambari-metrics-grafana
++ export AMS_GRAFANA_LOG_DIR=/var/log/ambari-metrics-grafana
++ AMS_GRAFANA_LOG_DIR=/var/log/ambari-metrics-grafana
++ export AMS_GRAFANA_PID_DIR=/var/run/ambari-metrics-grafana
++ AMS_GRAFANA_PID_DIR=/var/run/ambari-metrics-grafana
+ GRAFANA_HOME=/usr/lib/ambari-metrics-grafana
+ WORK_DIR=/usr/lib/ambari-metrics-grafana
+ DATA_DIR=/var/lib/ambari-metrics-grafana
+ LOG_DIR=/var/log/ambari-metrics-grafana
+ CONF_FILE=/etc/ambari-metrics-grafana/conf/ams-grafana.ini
+ MAX_OPEN_FILES=10000
+ PID_FILE=/var/run/ambari-metrics-grafana/grafana-server.pid
+ DAEMON=/usr/lib/ambari-metrics-grafana/bin/grafana-server
+ OUT_FILE=/var/log/ambari-metrics-grafana/grafana.out
+ STOP_TIMEOUT=5
+ '[' '!' -x /usr/lib/ambari-metrics-grafana/bin/grafana-server ']'
+ DAEMON_OPTS='--pidfile=/var/run/ambari-metrics-grafana/grafana-server.pid --config=/etc/ambari-metrics-grafana/conf/ams-grafana.ini
cfg:default.paths.data=/var/lib/ambari-metrics-grafana cfg:default.paths.logs=/var/log/ambari-metrics-grafana'
+ case "$1" in
+ echo -n 'Starting Ambari Metrics Grafana: .... '
Starting Ambari Metrics Grafana: .... + isRunning
+ status -p /var/run/ambari-metrics-grafana/grafana-server.pid grafana-server
+ '[' 1 -eq 0 ']'
+ cd /usr/lib/ambari-metrics-grafana
+ return=0
+ '[' 0 -eq 0 ']'
+ sleep 1
+ nohup /usr/lib/ambari-metrics-grafana/bin/grafana-server --pidfile=/var/run/ambari-metrics-grafana/grafana-server.pid
--config=/etc/ambari-metrics-grafana/conf/ams-grafana.ini cfg:default.paths.data=/var/lib/ambari-metrics-grafana
cfg:default.paths.logs=/var/log/ambari-metrics-grafana
+ [[ -s /var/run/ambari-metrics-grafana/grafana-server.pid ]]
+ i=0
+ timeout=10
+ sleep 1
+ i=1
+ '[' 1 -gt 10 ']'
+ sleep 1
+ i=2
+ '[' 2 -gt 10 ']'
+ sleep 1
+ i=3
+ '[' 3 -gt 10 ']'
+ sleep 1
+ i=4
+ '[' 4 -gt 10 ']'
+ sleep 1
+ i=5
+ '[' 5 -gt 10 ']'
+ sleep 1
+ i=6
+ '[' 6 -gt 10 ']'
+ sleep 1
+ i=7
+ '[' 7 -gt 10 ']'
+ sleep 1
+ i=8
+ '[' 8 -gt 10 ']'
+ sleep 1
+ i=9
+ '[' 9 -gt 10 ']'
+ sleep 1
+ i=10
+ '[' 10 -gt 10 ']'
+ sleep 1
+ i=11
+ '[' 11 -gt 10 ']'
+ echo FAILED
FAILED
+ exit 1

So the script first is running "cd /usr/lib/ambari-metrics-grafana" and then "nohup /usr/lib/ambari-metrics-grafana/bin/grafana-server
--pidfile=/var/run/ambari-metrics-grafana/grafana-server.pid --config=/etc/ambari-metrics-grafana/conf/ams-grafana.ini
cfg:default.paths.data=/var/lib/ambari-metrics-grafana cfg:default.paths.logs=/var/log/ambari-metrics-grafana"
as user ams.


When I run the command manually I didn use "su - ams -c '/usr/sbin/ambari-metrics-grafana
start'" because first I login as user ams and then I run the command as ams user.

I have solved the problem by recursively changing ownership of directories:


/var/log/ambari-metrics-grafana

/var/run/ambari-metrics-grafana


from root:root to ams:hadoop


[root@hdp-vora-slave ambari-metrics-grafana]# chown -R ams:hadoop /var/log/ambari-metrics-grafana
[root@hdp-vora-slave ambari-metrics-grafana]# chown -R ams:hadoop /var/run/ambari-metrics-grafana


After that I was able to start grafana service:


[root@hdp-vora-slave ambari-metrics-grafana]# su - ams -c '/usr/sbin/ambari-metrics-grafana
start'
Starting Ambari Metrics Grafana: .... OK


It looks like ambari is not changing the ownership before starting the service. It looks like
a bug and it should be fixed.


Br,

Pawel

________________________________
From: Aravindan Vijayan <avijayan@hortonworks.com>
Sent: Wednesday, June 15, 2016 11:13:28 PM
To: user@ambari.apache.org
Cc: Derek Palma
Subject: Re: Grafana service can't start because of missing config file

Hi Derek,

Please "cd" to the lib directory before running your command

cd /usr/lib/ambari-metrics-grafana/

/usr/lib/ambari-metrics-grafana/bin/grafana-server --pidfile=/var/run/ambari-metrics-grafana/grafana-server.pid
--config=/etc/ambari-metrics-grafana/conf/ams-grafana.ini cfg:default.paths.data=/var/lib/ambari-metrics-grafana
cfg:default.paths.logs=/var/log/ambari-metrics-grafana &

Any reason why you are not using this command -
su - ams -c '/usr/sbin/ambari-metrics-grafana start'

Thanks!
--
Thanks and Regards,
Aravindan Vijayan

From: Pawel Akonom
Reply-To: "user@ambari.apache.org<mailto:user@ambari.apache.org>"
Date: Wednesday, June 15, 2016 at 12:48 PM
To: "user@ambari.apache.org<mailto:user@ambari.apache.org>"
Cc: Derek Palma
Subject: Grafana service can't start because of missing config file

/usr/sbin/ambari-metrics-grafana start

Mime
View raw message