ripienaar / monitoring-scripts

Various monitoring related helpers

Home Page:http://www.devco.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

check_puppet.rb doesn't complain when it doesn't have read permissions

Dieterbe opened this issue · comments

check_puppet.rb gives a false sense of security if it doesn't have the correct read permissions, claiming no failed resources or events:

[dieter.plaetinck@dfvimeopweb1 ~]$ /usr/local/bin/check_puppet.rb -w 1200 -c 3600
OK: last run 8 minutes ago with 0 failed resources 0 failed events and currently enabled|time_since_last_run=522s;1200;3600;0 failed_resources=0;;;0 failed_events=0;;;0
[dieter.plaetinck@dfvimeopweb1 ~]$ sudo /usr/local/bin/check_puppet.rb -w 1200 -c 3600
OK: last run 8 minutes ago with 4 failed resources 4 failed events and currently enabled|time_since_last_run=526s;1200;3600;0 failed_resources=4;;;0 failed_events=4;;;0

should be an easy check, wanna give it a try fixing it?

For some reason, I'm getting this error even if the file is present and permission is correct:
UNKNOWN: Summary file not found or not readable. Check /var/lib/puppet/state/last_run_summary.yaml

Any idea?

@kstakledo so where is your file called that? There is a CLI flag to configure the path.

drwxr-xr-t 3 puppet puppet 4096 Jan 13 16:20 .
drwxr-x--- 12 puppet puppet 4096 Apr 9 2016 ..
-rw-r----- 1 root root 1024 Jan 13 16:20 classes.txt
drwxr-xr-x 2 root root 4096 Sep 29 2015 graphs
-rw-r----- 1 root root 160267 Jan 13 16:20 last_run_report.yaml
-rw-r--r-- 1 root root 874 Jan 13 16:20 last_run_summary.yaml
-rw-r----- 1 root root 6096 Jan 13 16:20 resources.txt
-rw-rw---- 1 root root 82239 Jan 13 16:20 state.yaml
root@dc1-aie-fms-01:/var/lib/puppet/state#

I already configured the flag. Same thing.

And you ran the check as root?

it's being ran as a different user, but as you can see the file is readable by everyone based on its permission.

The parent dir is not.

Good spot! Let me try and check.

Nope, didn't work. Even with 777 permission on both the directory and the file.

As the user you are running the the check as. Can you cat the file?

just added the user that does the check to the puppet group. all working now. thanks!