Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Could not initialize global default settings: Permission denied @ dir_s_mkdir #29

Open
ankh2054 opened this issue Dec 6, 2016 · 6 comments

Comments

@ankh2054
Copy link

ankh2054 commented Dec 6, 2016

Check_puppet_agent can only be run as root on my install.

str@puppetpal:/usr/lib/nagios/plugins$sudo -u nagios ./check_puppet_agent
Error: Could not initialize global default settings: Permission denied @ dir_s_mkdir - /home/str/.puppetlabs
UNKNOWN: Internal error: Puppet version unknown from Error: Could not initialize global default settings: Permission denied @ dir_s_mkdir - /home/str/.puppetlabs

cat /etc/sudoers

User_Alias NAGIOS=nagios
Cmnd_Alias PUPPETCHECK=/usr/bin/puppet config print runinterval,\
                       /usr/bin/puppet config print splay,\
                       /usr/bin/puppet config print splaylimit,\
                       /usr/bin/puppet config print agent_disabled_lockfile,\
                       /usr/bin/puppet config print lastrunfile,\
                       /usr/bin/puppet config print lastrunreport,\
                       /usr/bin/puppet config print pidfile
NAGIOS     ALL=NOPASSWD:PUPPETCHECK
@aswen
Copy link
Owner

aswen commented Dec 6, 2016

you execute this script as user puppet in workdir /home/str. Line 207 executes the puppet command as the user the script is running as and Puppet creates a .puppetlabs dir in the current dir.

I think this won't happen when you cd to ~nagios first. Can you give that a try?

I'm thinking about to add some check to the script to verify this. Or find out if there's a flag you can add to the puppet command to prevent it from creating a dir.

@ankh2054
Copy link
Author

ankh2054 commented Dec 6, 2016

Same issue, but then I thought let me run it as user STR, then I get the following error.

/usr/lib/nagios/plugins/./check_puppet_agent
UNKNOWN: last_run_summary.yaml not found, not readable or incomplete

I don't have /var/lib/puppet to change as per issue #28 .

Using root it works fine....

@aswen
Copy link
Owner

aswen commented Dec 6, 2016

hmm I will look into this later. Let you know asap.

@ankh2054
Copy link
Author

ankh2054 commented Dec 7, 2016

thank you very much. Great nagios plugin by the way.

@Rocco83
Copy link
Contributor

Rocco83 commented Dec 29, 2017

I think this may be related to #42

@Rocco83
Copy link
Contributor

Rocco83 commented Feb 26, 2018

I have reviewed it in Gentoo.
There is a bug in nrpe.
$HOME is not properly set to nrpe user home directory.
#44 to fix this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants