Difference between revisions of "Pandora: Documentation en: Share /var/spool directory between several Pandora servers"
Laura.cano (talk | contribs) |
Laura.cano (talk | contribs) |
||
Line 118: | Line 118: | ||
Where <i>[IP_SERVIDOR_NFS]</i> is the IP direction of the server that provides the NFS service. | Where <i>[IP_SERVIDOR_NFS]</i> is the IP direction of the server that provides the NFS service. | ||
+ | == Configuring Tentacle Server for NFS concurrent access == | ||
+ | |||
+ | Once the environment is ready, proceed to configure the Tentacle severs of both computers so that the XML files get distributed into separate folders, to avoid concurrency when the Dataservers process the files in both Pandora FMS servers. | ||
+ | |||
+ | |||
+ | To that end, create two folders within the directory /var/spool/pandora/data_in | ||
+ | |||
+ | mkdir /var/spool/pandora/data_in/xml_srv1 | ||
+ | mkdir /var/spool/pandora/data_in/xml_srv2 | ||
+ | |||
+ | |||
+ | Correct the permissions of both directories: | ||
+ | |||
+ | chmod pandora:apache /var/spool/pandora/data_in/xml_srv1 | ||
+ | chmod pandora:apache /var/spool/pandora/data_in/xml_srv2 | ||
+ | |||
+ | |||
+ | Edit the TENTACLE_EXT_OPTS value in the file /etc/init.d/tentacle_serverd to set the XML file delivery folder: | ||
+ | |||
+ | TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections" | ||
+ | |||
+ | In server number 1, it becomes: | ||
+ | |||
+ | TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.data:xml_srv1" | ||
+ | |||
+ | In sever number 2, it becomes: | ||
+ | |||
+ | TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.data:xml_srv2" | ||
+ | |||
+ | |||
+ | Finally, edit the configuration file of both Pandora FMS servers as follows: | ||
+ | |||
+ | # Pandora FMS server number 1 | ||
+ | # incomingdir: It defines directory where incoming data packets are stored | ||
+ | # You could set directory relative to base path or absolute, starting with / | ||
+ | incomingdir /var/spool/pandora/data_in/xml_srv1 | ||
+ | |||
+ | |||
+ | # Pandora FMS server number 2 | ||
+ | # incomingdir: It defines directory where incoming data packets are stored | ||
+ | # You could set directory relative to base path or absolute, starting with / | ||
+ | incomingdir /var/spool/pandora/data_in/xml_srv2 | ||
+ | |||
+ | |||
+ | After applying all the indicated changes, restart both the pandora_server service as well as the tentacle_serverd service in <b>both</b> servers. | ||
+ | |||
+ | |||
+ | [[Pandora:Documentation|Go back to Pandora FMS documentacion index]] | ||
+ | |||
+ | [[Category: Pandora FMS]] | ||
[[Category:Documentation]] | [[Category:Documentation]] |
Revision as of 11:38, 3 August 2020
Contents
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.
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.
1.4 Configuring Tentacle Server for NFS concurrent access
Once the environment is ready, proceed to configure the Tentacle severs of both computers so that the XML files get distributed into separate folders, to avoid concurrency when the Dataservers process the files in both Pandora FMS servers.
To that end, create two folders within the directory /var/spool/pandora/data_in
mkdir /var/spool/pandora/data_in/xml_srv1 mkdir /var/spool/pandora/data_in/xml_srv2
Correct the permissions of both directories:
chmod pandora:apache /var/spool/pandora/data_in/xml_srv1 chmod pandora:apache /var/spool/pandora/data_in/xml_srv2
Edit the TENTACLE_EXT_OPTS value in the file /etc/init.d/tentacle_serverd to set the XML file delivery folder:
TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections"
In server number 1, it becomes:
TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.data:xml_srv1"
In sever number 2, it becomes:
TENTACLE_EXT_OPTS="-i.*\.conf:conf;.*\.md5:md5;.*\.zip:collections;.*\.data:xml_srv2"
Finally, edit the configuration file of both Pandora FMS servers as follows:
# Pandora FMS server number 1 # incomingdir: It defines directory where incoming data packets are stored # You could set directory relative to base path or absolute, starting with / incomingdir /var/spool/pandora/data_in/xml_srv1
# Pandora FMS server number 2 # incomingdir: It defines directory where incoming data packets are stored # You could set directory relative to base path or absolute, starting with / incomingdir /var/spool/pandora/data_in/xml_srv2
After applying all the indicated changes, restart both the pandora_server service as well as the tentacle_serverd service in both servers.