monitoring-scripts icon indicating copy to clipboard operation
monitoring-scripts copied to clipboard

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

Open Dieterbe opened this issue 11 years ago • 11 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

Dieterbe avatar Jan 13 '14 21:01 Dieterbe

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

ripienaar avatar Jan 13 '14 21:01 ripienaar

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?

kstalledo avatar Jan 13 '17 05:01 kstalledo

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

ripienaar avatar Jan 13 '17 05:01 ripienaar

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.

kstalledo avatar Jan 13 '17 05:01 kstalledo

And you ran the check as root?

ripienaar avatar Jan 13 '17 05:01 ripienaar

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

kstalledo avatar Jan 13 '17 05:01 kstalledo

The parent dir is not.

ripienaar avatar Jan 13 '17 05:01 ripienaar

Good spot! Let me try and check.

kstalledo avatar Jan 13 '17 05:01 kstalledo

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

kstalledo avatar Jan 13 '17 05:01 kstalledo

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

ripienaar avatar Jan 13 '17 05:01 ripienaar

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

kstalledo avatar Jan 13 '17 05:01 kstalledo