Page 1 of 1

Nagios not loading bash_profile

Posted: Thu Jun 15, 2017 10:42 am
by hales8181
I am trying to get an AWS plug-in working (https://github.com/level23/nagios-cloudwatch-metrics)
I have installed awscli as the nagios user, and can run it on the command line (although had to edit the .bash_profile to add: export PATH=~/.local/bin:$PATH

I can run the nagios-cloudwatch-metrics from the command line with no issue, however when I try to run it from within nagios it can't seem to find the aws executable.

I'm presuming this is because nagios isn't loading the bash_profile - is there somewhere in a nagios config where I export PATH to get it to be able to find it?

Thanks

Re: Nagios not loading bash_profile

Posted: Thu Jun 15, 2017 1:01 pm
by tgriep
You could edit he script ans put the full in the command and that should work as well for you.
Add the directory to the aws command to this line and see if it works.

Code: Select all

COMMAND="aws cloudwatch get-metric-statistics"

Re: Nagios not loading bash_profile

Posted: Thu Jun 15, 2017 1:23 pm
by SteveBeauchemin
make a symbolic link to the location.

Code: Select all

ln -s /real-location/aws /usr/local/bin/aws

Re: Nagios not loading bash_profile

Posted: Thu Jun 15, 2017 1:37 pm
by dwhitfield
Thanks for the assist @SteveBeauchemin!

Re: Nagios not loading bash_profile

Posted: Tue Jun 20, 2017 8:17 am
by hales8181
Thanks, changing the COMMAND in the script to the location works - I'll give the symbolic link a try tomorrow and let you know!

Re: Nagios not loading bash_profile

Posted: Tue Jun 20, 2017 9:08 am
by dwhitfield
Ok, great, we'll be here tomorrow!