Pandora: Documentation en: Anexo Upgrade

From Pandora FMS Wiki
Revision as of 09:52, 22 April 2014 by Zarzuelo (talk | contribs) (Update from version 5.0 to 5.1)
Jump to: navigation, search

Go back to Pandora FMS documentation index

1 Upgrading from Previous Versions

1.1 Upgrading between Minor Releases

A minor version is e.g. if you upgrade from '3.1' to '3.1.1', or from a '3.1-rc1' to a '3.1-final' or '3.1-rc2'.

The upgrading / migrating process from same major level version implies that versions don't have any changes in their internal database schemata. You're only going to upgrade the software, not the database schemata or data.

Updating / migration between same major versions is very easy. Just replace your current setup with new release, e.g. from '3.1RC1' to '3.1RC2'. The steps to follow are:

1: Backup your database (only as a precaution, it shouldn't be necessary).

2: Backup your configuration files:

/etc/pandora/pandora_server.conf
pandora_console/include/config.php at your apache web root directory.
/etc/pandora/pandora_agent.conf
Any custom files (map images, plugins)

3. Use the method you prefer to update: RPM, DEB or tarball/sources

1.1.1 Installing additional Network and local Components

Since Pandora FMS 4.0.3 there are new network and local components out of the box. If you install this version all these new components will be installed by default. But if you have Pandora FMS 4.0.x installed you must run some auxiliar scripts to get all these new modules.

The scripts are located in <pandora_console>/extras and are the following:

network_components.mysql.sql
network_components.oracle.sql
network_components.postgreSQL.sql

You must execute the correct script using your DBMS for example MySQL:

mysql -u root -proot pandora < network_components.mysql.sql

These scripts will add new component groups and new network components.


Info.png

If something fails during script execution (e.g. a duplicate index because you have an already created group), you may modify them to properly insert the new modules on your database. Only scripts written in a valid SQL syntax are accepted here.

 


If you have the Enterprise Version, you're going to find find similar scripts for local modules, located at '<pandora_console>/enterprise/'. Thes scripts are the following:

local_components.mysql.sql
local_components.oracle.sql
local_components.postgreSQL.sql

You can execute the script like the previous ones, e.g.:

mysql -u root -proot pandora < local_components.mysql.sql


Template warning.png

Prior to the execution of the 'local_component' script, you have to execute the 'network_component' script to create new component groups.

 


1.1.2 Updating / Upgrading from RPM

You should know if it's an update or a reinstall first. Please check the package version which is installed on your system for this first:

rpm -q -a | grep pandora

If you're done installing Pandora's packages, they're e.g. going to be shown as a list of the package names and versions:

pandorafms_console-3.0.0-1

This means that you have the 'pandorafms_console' package in version '3.0.0-1'. If you want to install the same version that you have already installed, you may 'reinstall' by entering the following command:

rpm -i --force <nombre_paquete.rpm>

Sometimes 'updates' of versions with the same name and number are releases (they are development corrections, etc). In this case, it's recommended to reinstall by forcing the installation by the '--force' parameter.

If it's the same package, but from a higher version, you can update it with this command:

rpm -U <nombre_paquete.rpm>

To force an update of a version which you have already installed, it's very similar to the reinstallation. Doing so is going to keep your original files if they have been modified and the new version is going to have the same versions of the packages you've installed before. You can force the updating by entering this command:

rpm -U --force <nombre_paquete.rpm>

Be exceptionally careful before reinstalling or updating any package and generate security backups of:

  • /etc/pandora/pandora_server.conf: On Pandora FMS Server.
  • /etc/pandora/pandora_agent.conf: On Pandora FMS Agents.

Remember that (if you're using the Enterprise Version) you're also required to upgrade the Enterprise packages by using the same method explained here.

1.1.3 Using .deb Packages

If you are using a Debian or Ubuntu, or another system that uses .deb packages, just install the new packages. Debian package system will manage the uninstall of previous version and wild ask you to conserve the old version.

dpkg -i package_names.deb.

If you have dependency problems, please resolve it with:

apt-get install -f

Install new packages and replace the configuration files with your backup.

Remember that you (if you are using the Enterprise Version) will also have to upgrade packages by using the enterprise .deb packages.

1.1.3.1 UNIX Pandora Agent

If you update a UNIX Pandora Agent, the system asks to overwrite the plugin files in the final part of installation. Please check if the plugins have a modifications to avoid accidental overwriting of important files.

1.1.4 From Tarball / Sources

1.1.4.1 WEB Console

For the Console, first decompress the tarball file which contains Pandora FMS console to the '/tmp' directory:

cd /tmp
tar xvzf pandorafms_console_3.1xxxx.tar.gz 

Automated Way

In SUSE (VMware image or CD Appliance):

cd /tmp
cd pandora_console
./pandora_console_upgrade -p /srv/www/htdocs/pandora_console

The second parameter (in this example '/srv/www/htdocs/pandora_console'), is the path where the Pandora FMS console is already installed.

Under Ubuntu / Debian

cd /tmp
cd pandora_console
./pandora_console_upgrade -p /var/www/pandora_console

Manual Way

Untar the Pandora FMS console tarfile to '/tmp/pandora_console'. Please copy the contents of '/tmp/pandora_console' to the current Pandora FMS directory.

In SUSE (Vmware image or CD Appliance):

cp -R /tmp/pandora_console /srv/www/htdocs/
chown -R wwwrun:root /srv/www/htdocs/pandora_console

Under Ubuntu / Debian:

cp -R /tmp/pandora_console /var/www/
chown -R www-data:root /var/www/pandora_console

You can now safely delete the temp files from the directory '/tmp/pandora_console':

rm -Rf /tmp/pandora_console

The contents of the attachment directory should be coated with Apache user permissions (it's 'wwwrun:www' or 'www-data:www-data').

Enterprise Version (Manual only)

In order to upgrade the Enterprise version, the '/enterprise' directory and all its contents must be copied into the root directory of the Pandora FMS Web Console.

1.1.4.2 Server

For the Server, please decompress the tarball file which contains the Pandora FMS Server to '/tmp' first.

cd /tmp
tar xvzf pandorafms_server_3.1xxxx.tar.gz 

Automated way

To do the upgrade, please proceed using the upgrade script:

cd pandora_server
./pandora_server_upgrade --upgrade

Manual

This procedure will install new biraries and libraries. This doesn't update or upgrade the very important Pandora FMS tools. You're required to copy them one by one.

cd pandora_server
perl Makefile.PL
make
make install

Then please delete all temporal files if you don't need them anymore:

rm -Rf /tmp/pandora_server

Enterprise Version

The process is very similar to the previous server upgrade. Please decompress the tarball and execute this as 'root':

perl Makefile.PL
make
make install

This should upgrade your Enterprise server.

1.1.4.3 Agent

Please decompress tarball file:

cd /tmp
tar xvzf pandorafms_unix_agent_3.1xxx.tar.gz

Then run the installation tool that is going to install the agent as a whole (as well as tools and plugins that it requires). This installer generates an automatic backup of your configuration files under '/etc/pandora/pandora_agent.conf.yyyy-mm-dd.' Just execute the script and copy the contents of your backup configuration file under '/etc/pandora/pandora_agent.conf' by entering the following commands:

cd pandora_agent
./pandora_agent_installer --force-install
cp /etc/pandora/pandora_agent.conf.xxxxxxx /etc/pandora/pandora_agent.conf

Then please delete all temporal files if you don't need them anymore.

rm -Rf /tmp/pandora_agent

Experts only: You may only replace the agent executable '/usr/bin/pandora_agent' or 'c:\program files\pandora_agent\pandoraAgent.exe' to update the agent. Before that, make sure to stop the process or service to replace the executable. This should come in handy if a quick upgrade is intended.

Remember: There are no changes to the database schema in the minor version releases. It's sufficient to replace or upgrade the files as described above. Major versions, e.g. '3.0' to '3.1' or '2.1' to '3.0', might have serious changes in the database schemata and are going to require a database conversion.

Please refer to the the documentation for further details.

1.2 Migrating to another system

Sometimes we might want to use the new version of Pandora in a different system/distribution, for instance migrating from SUSE 11 to SUSE 12 or Ubuntu to CentOS.

For achieving this, we must install the new Pandora FMS application from scratch, or downloading the ISO appliance that we provide and install it.

- Once the new Pandora FMS instance is running in our new system, we perform a backup of the previous system's database:

mysqldump -u root -p pandora > backup_pandora_X.Y.sql

- After we transfer the backup_pandora_X.Y.sql backup file to the new system.

- We stop all the running processes except mysql.

/etc/init.d/pandora_server stop 
/etc/init.d/pandora_agent_daemon stop 
/etc/init.d/tentacle_serverd stop 
/etc/init.d/apache2 stop  o /etc/init.d/httpd stop (parar servidor apache, variará dependiendo de la distribución que usemos)

- We enter in a mysql shell with the root user in the new system. We access the pandora database (default name is pandora) and perform the import operation:

#mysql -u root -p
mysql>use pandora
Database changed
mysql>source /home/artica/backup_pandora_X.Y.sql ( put the full path to the backup file you created a few steps back )

- If you are migrating to a superior version, you must perform the database migration scripts.

- If you have changed your OS distribution, please bear in mind that the console PATH may have been modified in the system, and some database fields must be modified also in the pandora database. We must perform the following queries:

#mysql -u root -p
mysql>use pandora
Database changed
mysql>UPDATE tconfig SET value = '/var/www/html/pandora_console/attachment' WHERE token LIKE 'attachment_store'
mysql>UPDATE tconfig SET value = '/var/www/html/pandora_console/include/fonts/smallfont.ttf' WHERE token LIKE 'fontpath'

Where '/var/www/html/pandora_console/attachment' is the actual console PATH in your system.

This PATH variables must also been modified in the server and console configuration files.

- Once the database has been imported, we must make sure that the configuration files <CONSOLE_PATH>/pandora_console/include/config.php and /etc/pandora/pandora_server.conf have the same data in the fields dbname, dbuser, dbpass. If they are not equal we can do the following:

1.- Replace the new configuration files with the old ones

2.- Update the database credentials according to the values stored in the configuration files. Assuming that the new configuration file have the following data: dbname=pandora, dbuser=pandora1 y dbpass=pandora2, we should perform the following:

#mysql -u root -p
mysql>grant all privileges on pandora.* to 'pandora1'@'localhost' identified by 'pandora2';
mysql>flush privileges;

After that, we can start all the daemons again and access the Pandora console with all the previous configuration. If you changed your IP address you must modify the target_ip token in all the agent's configuration files.

This procedure is also valid for the Enterprise version.

1.3 Update a major version

This is the same process as with a minor version, but you will need to UPGRADE your database schema and data. This process is described below.

1.3.1 Upgrading Database Schemata (Major Versions only)

A major version is defined as upgrading from '3.0' to '3.1' or when migrating from '3.x' to '4.x'. An update from '4.0' to '4.0.1' is not considered upgrading to a major version. Therefore, it doesn't require a database upgrade.

Major-version upgrades or migrations require to perform a database upgrade. This upgrade is initiated from the command line interface and converts all information. You wouldn't lose anything in the upgrade, but anyway: ALWAYS conduct a full-backup first (not just the database, the entire code and configuration as well). Please follow the steps for upgrading as described below.

Install your packages for your new version of Pandora FMS (including the Enterprise packages). Required files to conduct the database upgrade are contained in these packages. You can find them in the '{PANDORA_CONSOLE}/extras' directory and under '{PANDORA_CONSOLE}/enterprise/extras' (enterprise only).

The {PANDORA_CONSOLE} is your Pandora FMS console directory which contains the console code. Under a SUSE it's '/srv/www/htdocs/pandora_console', under a Debian / Ubuntu, it's '/var/www/pandora_console'.

Please go to the 'extras' directory. There is a file called 'pandoradb_migrate_vX.Y_to_vX.Z.sql'. This file contains all the SQL code required to convert your X.Y.x database in a X.Z database ready to be used with a X.Z console and a X.Z server. The required steps to conduct the conversion are:

1: First of all: Conduct a backup of your current database!

mysqldump -u root -p pandora > backup_pandora_X.Y.sql

2: Stop your Pandora FMS Server and Web Server:

 /etc/init.d/pandora_server stop
 /etc/init.d/apache stop

3: Apply the upgrade script to update your database. You're going to find it once you have installed the new version packages. The script is going to ask your Pandora user password for MySQL (you can find it in your current '/etc/pandora/pandora_server.conf' file. We're assuming your Pandora FMS database is called "pandora" and it's running on the same machine you're running this command:

cd /srv/www/htdocs/pandora_console (or equivalent)
cat extras/pandoradb_migrate_vX.Y_to_vX.Z.sql | mysql -u pandora -p -D pandora 

After a few seconds / minutes, the database is ready to work with the latest version of Pandora FMS.

In case of any problems, the backup can be restored with this command (to go back to your previous version):

mysql -u root -p
> drop database pandora;
> create database pandora;
> use pandora;
> source backup_pandora_X.Y.sql

1.3.2 Enterprise DB schema

Template warning.png

Its very important execute the Open migration script before, located in "extras" folder,as indicated in the previous section

 


The process is almost the same. In the /enterprise/extras directory you have a file called pandoradb_migrate_vX.Y_to_vX.Z.sql. Use this file like the OpenSource migration explained above:

cd /srv/www/htdocs/pandora_console (or equivalent)
cat enterprise/pandoradb_migrate_vX.Y_to_vX.Z.sql | mysql -u pandora -p -D pandora

1.3.3 Update from version 5.0 to 5.1

1.3.3.1 Recon scripts and tasks

The fields of the recon tasks up to version 5.0 were 4 static fields. This fields have been changed in Pandora FMS 5.1 to a dynamic system of fields defined in recon scripts creation (similar to the plugin's macros). It involves some database's structure and storement changes.

Due this changes, we need to execute the following script after the upgrade:

/usr/share/pandora_server/util/pandora_migrate_recon_scripts.pl <dbname> <dbhost> <dbuser> <dbpass>

It will create in the recon scripts table the old 4 fields as dynamic fields and will adapt the used fields on recon tasks to the new format mantaining the compatibility with recon tasks previously created.

1.3.4 Update from version 4.x to 5.0

Template warning.png

On 5.0 version some API functions have changed, they are the following: set create_event

 


1.3.4.1 Compound alerts

In the version 5.0 the compound alerts have been deleted completely. If exist, will be deleted during the migration process.

1.3.4.2 Plugins

The plugin system has changed in Pandora FMS 5.0. The data of this kind of modules is now different, so an update must be performed.

If the current installation has plugins and plugin modules, after the upgrade we need to execute the following script:

/usr/share/pandora_server/util/pandora_migrate_plugins.pl <dbname> <dbhost> <dbuser> <dbpass>

The PSPZ files to import plugins of previous versions of 5.0 are compatibles with the new system.

1.3.5 Update from version 3.2.1 to 4.0

After update Console from Tarballs, DEB or RPM and access to Web console could appear the following errors:

Notice: Undefined index: dbtype in /var/www/pandora_console/include/functions_db.php on line 32 
Notice: Undefined index: dbtype in /var/www/pandora_console /include/functions_db.php on line 48 
Notice: Undefined index: dbtype in /var/www/pandora_console/include/functions_db.php on line 625 

For resolve these errors just add the following line in file <pandora_console_path>/include/config.php:

$config["dbtype"]="mysql";

If you have the SSH extension in your setup please delete it, it's old and will not run with 4.0 (and it will make console to crash).

rm -Rf < your pandora console root directory>/extensions/ssh_console*

Some 3.2 setups give problems in an autoincrement table, if it's your case, insert this in the SQL (by using the SQL manager in the console, or using mysql command line client):

ALTER TABLE tsesion AUTO_INCREMENT = 1;

After upgrade the server, a new servers will be available for high speed monitoring with ICMP and SNMP, for using that you need special requirements. Please read it carefully and disable it by default configuring following lines in your pandora_sever.conf:

snmpserver 0
icmpserver 0

1.4 Problems upgrading from a previous version (Perl Libraries)

Sometimes upgrade puts Pandora FMS libraries on different places where are installed old version, so after a upgrade you have two different versions of Pandora FMS libraries and you cannot know exactly what version will be used, if the old one or the new one. Best solution here is locate the libraries, delete all of them, and reinstall/upgrade. For that ejecute:

find /usr -name "Core.pm"

This will show you a few lines like:

/usr/lib/perl5/site_perl/5.10.0/PandoraFMS/Core.pm
/usr/lib/perl5/vendor_perl/5.10.0/Bootloader/Core.pm

Pandora FMS libraries are placed on /usr/lib/perl5/site_perl/5.10.0/PandoraFMS/. Delete it safely and reinstall again (from packages or tarball sources).

rm -Rf /usr/lib/perl5/site_perl/5.10.0/PandoraFMS/

Perl version and exact location may differ in each linux distro, so you will need to locate prior deleting the directory written here.

1.5 Problems upgrading from a previous version (Database)

If you find a problem is probably because you are upgrading a 2.x version that comes from a version 1.x, or because it has made manual changes to the DB scheme. If you get a message like this:

ERROR 1005 (HY000) at line 101: Can't create table './pandora/talert_template_modules.frm' (errno: 150)

This is due because a problem in MySQL because some fields has no the expected type. id_agente_modulo field in 2.1 should have bigint(10) type. If you have migrated from a 1.x before you will have this problem. Before running the migration tool to 3.0, enter this command in the mysql console:

ALTER TABLE tagente_modulo MODIFY id_agente_modulo bigint(10) unsigned NOT NULL auto_increment;

And try to run again the upgrade tool. Please remember that you need InnoDB support for your MySQL database server.

2 Security upgrades / Patches

A security upgrade or security patch is a small patch usually for Console, but you can also have a security patch for server. In both cases the source package to "patch" the problem can be presented in several formats:

2.1 From distro packages

A package (RPM or DEB): just install the package:

Ubuntu/Debian

dpkg -i <package_name>

SUSE/RedHat/CentOS/Fedora

rpm -u <package_name>

2.2 From tarball or SVN

A package in tarball/Source format. This implies you know a bit more about the internals of Pandora FMS, that means, you know "where" are the files you will replace. Using a tarball is just a way to say, you have the source files and you will replace that for your installed Pandora FMS files.

In Console:

All files should be put on /var/www/pandora_console (Ubuntu/debian), /srv/www/htdocs/pandora_console (SUSE), or other directories, depending on distros.

In Server:

It depends on your version and install method, but the files you will need to replace should be searched before:

  • Libraries: find /usr -name "PluginServer.pm", usually should be at /usr/lib/perl5/PandoraFMS
  • Binaries: find /usr -name "pandora_server", usually should be at /usr/bin

2.2.1 Example of manual Console update

For example, if you have a tarball called pandorafms_console_3.1_securityfix_may2011.tar.gz, do the following steps:

(Supposing you're on a standard SUSE system)

cd /tmp
tar xvzf /home/youruser/download/pandorafms_console_3.1_securityfix_may2011.tar.gz
cd pandora_console
cp -R /srv/www/htdocs/pandora_console
sudo chown -R wwwrun /srv/www/htdocs/pandora_console

2.2.2 Example of manual Server update

For example, if you have a tarball called pandorafms_server_3.1_securityfix_may2011.tar.gz, do the following steps:

(Supposing you're on a standard SUSE system)

cd /tmp
tar xvzf /home/youruser/download/pandorafms_server_3.1_securityfix_may2011.tar.gz
cd pandora_server

(Locate where are your Pandora library files)

sudo find /usr -name "NetworkServer.pm"
.
.
/usr/lib/perl5/site_perl/5.12.1/PandoraFMS/NetworkServer.pm

Whoah, that's not the default installation dir (because in this same it's installed from the sources, not from RPM). We know now the location of Pandora FMS libraries, at /usr/lib/perl5/site_perl/5.12.1/PandoraFMS/ directory, so copy all updated libraries overwriting the old ones (this step is the same -but with different directory names- if you have your system installed from packages instead from sources):

sudo cp -R lib/PandoraFMS/*.pm /usr/lib/perl5/site_perl/5.12.1/PandoraFMS/

Don't forget to copy also the binaries and tools

sudo cp -R bin/* /usr/bin 

(Forget the warning message about skipping copy for PandoraFMS directory, it's normal).

sudo cp -R util/* /usr/share/pandora_server/

3 Console updates using Update Manager

3.1 OpenSource Updates

Since Pandora FMS 4.0.2 you can update, using OpenSource version, from weekly semiautomatic updates. This feature is based on a improvement of Update Manager system, previously only available with Enterprise version, now you can check online if there is a new update and download and update your console automatically under request.

This feature has the following characteristics:

  • The server which has Pandora FMS console must be connected to Internet.
  • Update Manager will contact our server for new updates (on Sourceforge). Send anonymous statistical data about the use of Pandora FMS (# of agents).
  • An update from Sourceforge will be downloaded from weekly updates folder.
  • The updates are incremental and they have the content of the whole console, so this process could take a lot of time (the packages weight is about 25 MB).
  • Updates are automatic: they are not reviewed by the team, in the 99% of cases no problem is expected but we could not guarantee nothing if a problem occurs.
  • The updates are only for console not for agents and server.

3.1.1 Console updating process

It's very easy. Just go to Extensions -> Update Manager. The main screen allow you to check for new updates available to be installed, also you can see the list with previous updates installed (in this picture there is no previous updates yet). Click on install.



Update manager open.png

Click on install button.

Info.png

To use Update Manager your server which hosts Pandora console must be connected to Internet. By default Pandora will use WGET to download the packages (it's faster), it's possible to use CURL method (you can change it in Pandora configuration) but it's slower

 




Update manager open2.png

When the packages was downloaded and installed, you will return to main page which will be like this. It shows the updates installed and a message saying there is no more updates available. Congratulations, you have updated to a new version!.



Update manager open3.png

3.2 Enterprise updates

Unlike Open updates, Enterprise updates have several additional features:

  • 100% tested by development team, so you can enjoy updates the same day (even a few hours later) that an incident was open.
  • Specific updates (incremental) which allow you to update only the part that is outdated, without downloading heavy packages.
  • Offline updates are allowed, downloading packages from support page for Pandora FMS installation which are not connected to Internet (due to security reasons).

To use Enterprise version of Update Manager first of all you must configured your serial number and the kaygen installed

Para poder usar Update Manager en la versión enterprise, primero ha debido configurar correctamente su nº de serie y tener instalado el "keygen", y configurado éste adecuadamente, en la pantalla de setup, tal y como se muestra aquí:



Update manager4.png



From Operation>Extensions>Open Update Manager, you can access to Update Manager. If you have Enterprise versions installed you can use this interface, if not Open version will be displayed.



Update manager5.png



In this page you can see the current version number of Pandora FMS and will notify you for new updates available.

To update to a new version, click on "Update" button.

You can mark the checkbox "Overwrite local changes" which will overwrite any existing local modification of the files.

3.2.1 "Offline" updates

You can download "offline" updates of Pandora which are packages with .OUM extension. To do that go to Pandora FMS official support page and download .OUM files which will be like this:



Update manager7.png



Upload it to the console using this control:



Update manager6.png



The update will be applied automatically.

Info.png

Also you can update with zip files as the same method of OUM files. This zip files are generated by our workers.

 


3.3 PHP engine additional configuration to operate with Update Manager

To ensure Open Update Manager is executing properly it needs more memory than the amount assigned by default. To assign more memory to PHP execution you must edit the php.ini file and set the reserved memory to at least 64M.

The line is:

memory_limit = 64M	; Maximum amount of memory a script may consume (16MB)

Commonly, on Debian/Ubuntu systems the file is located in directory /etc/php5/apache2.

Go back to Pandora FMS documentation index