pmp-check-file-privs does not throw the proper error on dir permissions

Bug #1024001 reported by Rolf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Percona Monitoring Plugins
Fix Released
Medium
Unassigned

Bug Description

If nagios user does not have access to dir, error is not handled properly:

   while read datadir; do
      FILES="$(find "${datadir}" \! -group "${OPT_UNIX_GROUP}" -o \! -user "${OPT_UNIX_USER}")" || exit $?
      if [ "${FILES}" ]; then
         WRONG=1
         NOTE2="${NOTE2:+${NOTE2} }${FILES}"
      fi
      NOTE="OK all files/directories have correct ownership."
   done < "${DATADIRS}"

test:

$ find "/mysql/data" ! -group "mysql" -o ! -user "mysql" || echo "fail"
/mysql/data/ibdata1
/mysql/data/mysql-procs.log.6
/mysql/data/mysql-procs.log.3
find: /mysql/data/somedb: Permission denied
find: /mysql/data/somedb2: Permission denied
fail

Solution:

Instead of existing set crit/warn.

Tags: nagios
Revision history for this message
Rolf (rolf-winmutt) wrote :

Sorry, should have read:
Instead of existing exit, set crit/warn.

Revision history for this message
Rolf (rolf-winmutt) wrote :

Bump.

tags: added: nagios
Changed in percona-monitoring-plugins:
status: New → In Progress
milestone: none → 1.0.3
importance: Undecided → Medium
Revision history for this message
Roman Vynar (roman-vynar) wrote :

It's not a good idea to warn/crit in case of permissions problem because this is an issue with the user permissions with which you call the script, e.g. nagios user, but not with mysql itself or its bad file permissions.
So the proper way is to provide a descriptive error message and UNK code in case of any problem when looking for files not owned by mysql user.

E.g.
[root@centos6 ~]# sudo -u nagios ./nagios/bin/pmp-check-mysql-file-privs
UNK find: `/var/lib/mysql/cacti': Permission denied find: `/var/lib/mysql/mysql': Permission denied find: `/var/lib/mysql/performance_schema': Permission denied find: `/var/lib/mysql/percona': Permission denied

instead of silent exit.

summary: - pmp-check-file-privs does not throw crit/warn on dir permissions
+ pmp-check-file-privs does not throw the proper error on dir permissions
Changed in percona-monitoring-plugins:
status: In Progress → Fix Committed
Changed in percona-monitoring-plugins:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.