Page 1 of 4

Scheduled Backups not running

Posted: Thu Jan 22, 2015 6:24 pm
by krobertson71
Nagios r2.3 RedHat el6 64bit

We added a new volume called backups. I have set a daily schedule to run at 1pm every day. I put in the directory /backups/ and ran the test and it came back writeable.

However I look today, nothing there.. I cannot find an error anywhere.

I did trying running the backup_xi.sh script with --help to see if I could specify the directory there and get this in return.

[nagios@nagiasp01 scripts]$ ./backup_xi.sh -help
./backup_xi.sh: line 6: ./config.dat: Permission denied
./backup_xi.sh: line 7: ./config.dat: No such file or directory

Any ideas?

Re: Scheduled Backups not running

Posted: Thu Jan 22, 2015 6:35 pm
by Box293
Can you show us the permissions of the directory backups:

Code: Select all

ll /backups
Also what is the output of these commands:

Code: Select all

cat /etc/group | grep apache
cat /etc/group | grep root
cat /etc/group | grep nagios

Re: Scheduled Backups not running

Posted: Thu Jan 22, 2015 9:25 pm
by krobertson71

Code: Select all

drwxrwxr-x    3 apache netdev  4096 Jan 22 11:20 backups
We used to have the owner as nagios:netdev (our teams group) and the test write from the gui would fail.

There is another thread on this and it was determined the Apache user was doing the check. Is it not the user that is writing to the directory?

When we tried nagios ngcmd it would pass the write test just fine just as apache:netdev passes as well.

As you see below, the users are in their proper groups. This has not been touched since the install.

Code: Select all

cat /etc/group | grep apache
apache:x:48:
nagios:x:10003:nagios,apache
nagcmd:x:10004:nagios,apache
[kar54@nagiasp01 /]$ cat /etc/group | grep nagios
nagios:x:10003:nagios,apache
nagcmd:x:10004:nagios,apache
[kar54@nagiasp01 /]$ cat /etc/group | grep root
root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
disk:x:6:root

Re: Scheduled Backups not running

Posted: Thu Jan 22, 2015 10:25 pm
by Box293
You are correct that the GUI test is run as apache.

From what I understand, the backup runs as the user root.

I would add root to the netdev group and I think it would fix your problem.

Re: Scheduled Backups not running

Posted: Fri Jan 23, 2015 10:13 am
by krobertson71
Can we get that verified? The backup for NLS does not run as root as backups are working fine on that system. I know they are two differnent systems, but the scripts that execute the backups are not owned by root, they are owned by nagios.

Re: Scheduled Backups not running

Posted: Fri Jan 23, 2015 10:28 am
by krobertson71
Also, the "test permissions" button when pressed if it returns an error it states to make sure the Nagios user or Nagios group has permissions to the directory.

So either this check is totally misleading or root is not writing to the directory.

Not everyone has root access to their nagios system. Some bigger organizations have a separate monitoring team and the OS is managed by the Linux teams.

Re: Scheduled Backups not running

Posted: Fri Jan 23, 2015 10:29 am
by scottwilkerson
krobertson71 wrote:Can we get that verified? The backup for NLS does not run as root as backups are working fine on that system. I know they are two differnent systems, but the scripts that execute the backups are not owned by root, they are owned by nagios.
Kris,

You are correct, the backups are kicked off by the cmdsubsys cron which is run as the nagios user.

However your directory group ios set to netdev which doesn't have the nagios nor apache group as part of it.

Either add nagios to the netdev group,
change the owner to nagios and add apache to the netdev group
or, change the group to nagios

Being nagios and apache are both parth of the nagios group, it would pass if the nagios group was assigned to the directory

Re: Scheduled Backups not running

Posted: Fri Jan 23, 2015 10:55 am
by krobertson71
Nagios was the owner of the directory orginally but the write test would fail so we took that to be the nagios user was not the proper one to use.

So, you are saying the permissions should be nagios:nagcmd or nagios:nagois? The nagcmd group has both apache and nagios users in it.

Code: Select all

cat /etc/group | grep nagcmd
nagcmd:x:10004:nagios,apache

Re: Scheduled Backups not running

Posted: Fri Jan 23, 2015 10:58 am
by krobertson71

Code: Select all

 cat /etc/group | grep nagios
nagios:x:10003:nagios,apache
nagcmd:x:10004:nagios,apache
When I run the grep like this it shows both groups. Is there a difference. They look identical to me. Both users are members of both groups.

Re: Scheduled Backups not running

Posted: Fri Jan 23, 2015 11:58 am
by scottwilkerson
Either of them as the group would work, the problem is you have netdev currently as the group.

At first you had nagios as the owner and the test wouldn't work becuse the test is done through the UI as apache.

Changing the group to nagios should fix all of this

Code: Select all

chown nagios:nagios /backups