Pandora: Documentation en: Share /var/spool directory between several Pandora servers

From Pandora FMS Wiki
Jump to: navigation, search

1 Introduction

Pandora FMS dataserver uses the /var/spool/pandora/data_in directory, and all its contents to manage the information that recieves and send to the software agents.

That directory also needs to be accessible by the console of Pandora, so the instructions that it sends to the agents can reach them, being config files or collections.


If we have several servers with severs with several consoles, the default configuration, every console will be able to manage the agents of the server where it is located.


Now, let's suppose that we have several Pandora servers working in a common environment.

Nfs schema.png

The agents of each server will communicate with their assigned dataserver using the data_in folder. On a multiple dataserver architecture with a single console, we will unify the agents management using NFS to share this pool of common information.


1.1 First steps

Install the nfs-utils package on all the systems that will share the directory by NFS:

yum install -y nfs-utils

1.2 Configuration of the NFS server

Edit the file /etc/export adding the following:

/var/spool/pandora/data_in [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)

Where [IP_CLIENTE] will be the IP of the system with which the resource is going to be shared. For example:

/var/spool/pandora/data_in/conf [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/collections [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/md5 [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)
/var/spool/pandora/data_in/netflow [IP_CLIENTE](rw,sync,no_root_squash,no_all_squash)

In case that we have the firewall enabled in our system, open the required ports:

# CentOS
firewall-cmd --permanent --zone=public --add-service=nfs
firewall-cmd --reload


Once done, we start the services:

# CentOS
systemctl start rpcbind
systemctl start nfs-server
systemctl start nfs-lock
systemctl start nfs-idmap


Configure NFS to start with the system powers on:

systemctl enable rpcbind
systemctl enable nfs-server
systemctl enable nfs-lock
systemctl enable nfs-idmap


To refresh any change in the setup of the /etc/export restart nfs-server


systemctl restart nfs-server

1.3 Configuration of the NFS clients

Note: If that system doesn't have apache installed (is not necessary to install it), add to /etc/passwd and /etc/group the user apache to avoid permission conflicts:

echo "apache:x:48:48:Apache:/usr/share/httpd:/sbin/nologin" >> /etc/passwd
echo "apache:x:48:" >> /etc/group


Check the folder permissions:

chown pandora:apache /var/spool/pandora/data_in
chmod 770 /var/spool/pandora/data_in


Check that we can mount successfully the remote folder:

mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/conf /var/spool/pandora/data_in/conf
mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/md5 /var/spool/pandora/data_in/md5
mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/collections /var/spool/pandora/data_in/collections
mount -t nfs [IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/netflow /var/spool/pandora/data_in/netflow


Where [IP_SERVIDOR_NFS] will the the IP direction of the server that provides the NFS service. For example:

mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/conf /var/spool/pandora/data_in/conf
mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/md5 /var/spool/pandora/data_in/md5
mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/collections /var/spool/pandora/data_in/collections
mount -t nfs 192.168.70.10:/var/spool/pandora/data_in/netflow /var/spool/pandora/data_in/netflow


If the previous command fails, check: - Firewall status. - If we are running as root. - If the directory where we want to make the mounting exists.


If everything is right untill now, configure the system to be mounted automatically if there is a reboot, editing the file /etc/fstab:

# Add the following lines to the configuration file /etc/fstab
[IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/conf    /var/spool/pandora/data_in/conf   nfs defaults 0 0
[IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/md5    /var/spool/pandora/data_in/md5   nfs defaults 0 0
[IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/collections    /var/spool/pandora/data_in/collections   nfs defaults 0 0
[IP_SERVIDOR_NFS]:/var/spool/pandora/data_in/netflow    /var/spool/pandora/data_in/netflow    nfs defaults 0 0

Where [IP_SERVIDOR_NFS] is the IP direction of the server that provides the NFS service.