upgrading nagios-fusion with .OVA vmware image

This support forum board is for questions relating to Nagios Fusion.
dxk9_dtman
Posts: 12
Joined: Fri Nov 30, 2012 1:59 pm

upgrading nagios-fusion with .OVA vmware image

Post by dxk9_dtman »

Hi,
I am currently running Nagios-Fusion 4.0.0 on a .ova image via VMWare workstation player. I can see 4.0.1 is available now. Since this is an image, I assume I just need to download the latest .OVA image and run it. I assume I wouldn't upgrade the existing image. Has anyone tried it though?
https://www.nagios.com/downloads/nagios-fusion/vmware/
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by npolovenko »

Hello, @dxk9_dtman. OVA is basically an image of the whole computer. You can't install one OVA on top of the other. You can run a new OVA instead of the old one but you'll lose all your configurations.
To update an existing fusion please connect to the Virtual Machine using ssh and type the following command:

Code: Select all

curl https://assets.nagios.com/downloads/nagiosfusion/upgrade.sh | sh
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dxk9_dtman
Posts: 12
Joined: Fri Nov 30, 2012 1:59 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by dxk9_dtman »

Thanks, so it looks like you are saying its FINE to upgrade nagios-fusion running and installed from the OVF/OVA file. At least a minor version upgrade. Good to know. Still I wanted to back it up first, back up my configs.

[root@nagios-fusion scripts]# ./backup_fusion.sh
Backing up Nagios Fusion directory...
tar: Removing leading `/' from member names
Backing up MySQL databases...
mysqldump: Couldn't execute 'SHOW TRIGGERS LIKE 'polled\_extras'': Got error 28 from storage engine (1030)
Error backing up MySQL database 'fusion' - check the password in this script!
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by npolovenko »

@dxk9_dtman, Hmm, looks like there's a password issue. Have you changed any MySQL passwords recently? What version of Fusion are you running right now? And were you running the script as a sudo?
Let's see if you can authenticate to MySQL with standard credentials:

Code: Select all

mysql -u root -pfusion
Finally, please upload the contents of the backup_fusion.sh script here.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dxk9_dtman
Posts: 12
Joined: Fri Nov 30, 2012 1:59 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by dxk9_dtman »

Nagios Fusion 4.0.0
full=4.0.0
major=4
minor=0.0
releasedate=2017-07-17
release=4000

[root@nagios-fusion scripts]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
37G 24G 12G 66% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 477M 95M 357M 22% /boot


I was able to take a backup a few months ago. ls -la 1502307633.tar.gz
7804057 Aug 9 15:41 1502307633.tar.gz

Have I changed any passwords?
nope, never touched mysql


RE: mysql -u root -pfusion
Yes, I could get in that way, I connected in fine.

So, the test shows the password has not changed, yet I get this. Same result if its prefixed with 'sudo'
[root@nagios-fusion ~]# /usr/local/nagiosfusion/scripts/backup_fusion.sh
Backing up Nagios Fusion directory...
tar: Removing leading `/' from member names
Backing up MySQL databases...
mysqldump: Got errno 28 on write
Error backing up MySQL database 'fusion' - check the password in this script!

Code: Select all


[root@nagios-fusion scripts]# cat backup_fusion.sh
#!/bin/bash

BASEDIR=$(dirname $(readlink -f $0))

# Import all CFG variables
. $BASEDIR/../var/fusion-sys.cfg
php $BASEDIR/import_fusionconfig.php > $BASEDIR/config.dat
. $BASEDIR/config.dat
rm $BASEDIR/config.dat

BACKUPLOG="$proddir/var/log/backup.log"
ts=`date +%s`


###############################
# USAGE / HELP
###############################
usage () {
    echo ""
    echo "Use this script to backup Nagios Fusion."
    echo ""
    echo " -n | --name        Set the full name of the backup minus the .tar.gz"
    echo " -p | --prepend     Prepend a string to the .tar.gz name (ignored when using -n)"
    echo " -a | --append      Append a string to the .tar.gz name (ignored when using -n)"
    echo " -d | --directory   Change the directory to store the compressed backup"
    echo ""
}


###############################
# ADDING LOGIC FOR NEW BACKUPS
###############################
while [ -n "$1" ]; do
    case "$1" in
        -h | --help)
            usage
            exit 0
            ;;
        -n | --name)
            fullname=$2
            ;;
        -p | --prepen)dm
            prepend=$2"."
            ;;
        -a | --append)
            append="."$2
            ;;
        -d | --directory)
            rootdir=$2
            ;;
    esac
    shift
done

if [ -z $rootdir ]; then
    rootdir="/store/backups/nagiosfusion"
fi

# Move to root dir to store backups
cd $rootdir


#############################
# SET THE NAME & TIME
#############################
name=$fullname

if [ -z $fullname ]; then
    name=$prepend$ts$append
fi

# Get current Unix timestamp as name
if [ -z $name ]; then
    name=$ts
fi

# My working directory
mydir=$rootdir/$name

# Make directory for this specific backup
mkdir -p $mydir


##############################
# BACKUP DIRS
##############################
echo "Backing up Nagios Fusion directory..."
tar czfp $mydir/nagiosfusion.tar.gz /usr/local/nagiosfusion


##############################
# BACKUP DATABASES
##############################
mkdir -p $mydir/mysql
echo "Backing up MySQL databases..."
mysqldump -h $cfg__database__fusion__host -u $cfg__database__fusion__user --password="$cfg__database__fusion__pass" --add-drop-database -B $cfg__database__fusion__dbname > $mydir/mysql/fusion.sql
res=$?
if [ $res != 0 ]; then
    echo "Error backing up MySQL database 'fusion' - check the password in this script!" | tee -a $BACKUPLOG
    rm -r $mydir
    exit $res;
fi


##############################
# BACKUP CRONJOB ENTRIES
##############################
mkdir -p $mydir/cron
echo "Backing up nagiosfusion cronjob..."
cp /etc/cron.d/nagiosfusion $mydir/cron/nagiosfusion
echo "Backing up cronjobs for Apache..."
cp /var/spool/cron/apache $mydir/cron/apache


##############################
# BACKUP SUDOERS
##############################
sudoers=/etc/sudoers.d/nagiosfusion
if [ -f "$sudoers" ]; then
    mkdir -p $mydir/sudoers
    echo "Backing up nagiosfusion sudoers.d file..."
    cp $sudoers $mydir/sudoers
fi


##############################
# BACKUP LOGROTATE
##############################
echo "Backing up logrotate config files..."
mkdir -p $mydir/logrotate
cp -rp /etc/logrotate.d/nagiosfusion $mydir/logrotate


##############################
# BACKUP APACHE CONFIG FILES
##############################
echo "Backing up Apache config files..."
mkdir -p $mydir/httpd
cp -rp $httpdconfdir/nagiosfusion.conf $mydir/httpd


##############################
# COMPRESS BACKUP
##############################
echo "Compressing backup..."
tar czfp $name.tar.gz $name
rm -rf $name

# Change ownership
chown $nagiosuser:$nagiosgroup $name.tar.gz

if [ -s $name.tar.gz ];then

    echo " "
    echo "==============="
    echo "BACKUP COMPLETE"
    echo "==============="
    echo "Backup stored in $rootdir/$name.tar.gz"

    exit 0;
else
    echo " "
    echo "==============="
    echo "BACKUP FAILED"
    echo "==============="
    echo "File was not created at $rootdir/$name.tar.gz"
    rm -r $mydir
    exit 1;
fi


One strange thing is that fusion-sys.cfg does show the correct password for the db, however when you run it by hand you have no space between the -p and password and it works. If you add the space manually, it does not work.

Another thing I noticed is that cfg_database_fusion_user is fusion not root. Manually (just running the mysql command I can connect with both root and the fusion user, using the default password.

Code: Select all

[root@nagios-fusion scripts]# ./import_fusionconfig.php --help
cfg__root_dir='/usr/local/nagiosfusion'
cfg__base_url='/nagiosfusion'
cfg__database__connection_timeout=10
cfg__database__fusion__type='mysql'
cfg__database__fusion__user='fusion'
cfg__database__fusion__pass='fusion'
cfg__database__fusion__host='localhost'
cfg__database__fusion__port=''
cfg__database__fusion__dbname='fusion'
cfg__database__fusion__persist=1
Why is there an import script, but no output script?

Breaking down the above backup script manually and running each piece works. For example I just ran the mysqldump command to /store/backups/fusion_dump.sql and it seems to be running fine. Actually, I had to kill it. It was 99% full disk space up to 17 GB on the dump. So, I need to figure out how the db got this big and how to get rid or archive some .
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: upgrading nagios-fusion with .OVA vmware image

Post by dwhitfield »

This article says it is for XI, but it should work for fusion as well: https://assets.nagios.com/downloads/nag ... M-Disk.pdf

It's not able to complete because you are running out of disk space.
dxk9_dtman
Posts: 12
Joined: Fri Nov 30, 2012 1:59 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by dxk9_dtman »

Thanks, for this article on the re-sizing.

My first thought was to figure out why or how/where/why its storing so much data, and get rid of some. We certainly don't need to keep four months of data around. How do I trim the fat?

It's hard to believe that with just retaining data for 5 days (the default), I'm using 24 GB of storage. I knocked it down to 3 days, but I'm still showing 24 GB used.

[root@nagios-fusion cron]# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
37G 24G 12G 66% /
tmpfs 931M 0 931M 0% /dev/shm
/dev/sda1 477M 95M 357M 22% /boot

Here is the culprit. How can I reduce the size? Do I need to restart something to switch from 5 to 3 days retention/purge?
-rw-rw---- 1 mysql mysql 22936551424 Nov 30 11:10 ibdata1

Why is the polled extras table so big? 21 GB?? how do we contain it ?
polling has now stopped on this server.
nagios_fusion_tables.PNG
I just ran the truncate_polled script as advised on another post. However, I'm still seeing the same size.
You do not have the required permissions to view the files attached to this post.
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by npolovenko »

@dxk9_dtman
My first thought was to figure out why or how/where/why its storing so much data, and get rid of some. We certainly don't need to keep four months of data around. How do I trim the fat?
When you changed the retention period Fusion was supposed to automatically cut off the outdated data.

The polled_extras data table contains only the data that is used and rendered by fusion at the present moment. The way Fusion works is it downloads a lot of data from the XI servers, including checks, all possible parameters, and many other data. So if the XI servers have thousands of checks, i'd say 22gb is not an unordinary size for this table.
You may check the box that says "Ignore XI host/service meta data" in the Fused server settings. That should reduce the data consumption if that is your main concern.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
dxk9_dtman
Posts: 12
Joined: Fri Nov 30, 2012 1:59 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by dxk9_dtman »

At this point all our Nagios servers are Core, so its not an option.

I went ahead and upgraded to 4.0.1. Since this is nagios fusion not nagios xi the auto script for making the file size bigger didn't work. No harm was done it just rebooted and kept my same file size.

So my only issue is that I can't do a backup because my table is too big. The truncate_poller.php script must not look at the polled_extras table, and switching from 5 to 3 days retention has NO effect on the polled_extras table.

Does anyone know how to purge the polled_extras table?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: upgrading nagios-fusion with .OVA vmware image

Post by npolovenko »

@dxk9_dtman , You can truncate that data table with the following command:

Code: Select all

echo "truncate table polled_extras;" | mysql -u fusion -pfusion fusion
At this point all our Nagios servers are Core, so it's not an option.
I'm sorry I didn't specify. That option can actually be enabled in Fusion. So if you click on Servers menu, and click on settings next to the individual fused server, you'll see it.
screen12345.png
You can check that box to potentially lower the disk consumption.
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked