Nagios not loading bash_profile

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
hales8181
Posts: 33
Joined: Thu Jan 19, 2017 11:15 am

Nagios not loading bash_profile

Post 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
User avatar
tgriep
Madmin
Posts: 9190
Joined: Thu Oct 30, 2014 9:02 am

Re: Nagios not loading bash_profile

Post 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"
Be sure to check out our Knowledgebase for helpful articles and solutions!
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Nagios not loading bash_profile

Post by SteveBeauchemin »

make a symbolic link to the location.

Code: Select all

ln -s /real-location/aws /usr/local/bin/aws
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios not loading bash_profile

Post by dwhitfield »

Thanks for the assist @SteveBeauchemin!
hales8181
Posts: 33
Joined: Thu Jan 19, 2017 11:15 am

Re: Nagios not loading bash_profile

Post 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!
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Nagios not loading bash_profile

Post by dwhitfield »

Ok, great, we'll be here tomorrow!
Locked