migrating psql to my sql. custom actions componet info lost.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
benhank
Posts: 1264
Joined: Tue Apr 12, 2011 12:29 pm

migrating psql to my sql. custom actions componet info lost.

Post by benhank »

HOKAY!
I have a server running xi 5.5.7
I am testing the postgreql to mysql migration by following these steps as defined in the kb article:

Code: Select all

cd /tmp
wget https://github.com/ChrisLundquist/pg2mysql/archive/master.zip
unzip master.zip
cd /tmp/pg2mysql-master/
pg_dump --no-acl --no-owner --format p --data-only -U nagiosxi nagiosxi > nagiosxi.psql
php pg2mysql_cli.php nagiosxi.psql nagiosxi.mysql myisam
wget https://assets.nagios.com/downloads/nagiosxi/scripts/nagiosxi_create_db.sql
mysql -uroot -pnagiosxi < nagiosxi_create_db.sql
perl -l -n -i -e 'print $_; print "max_allowed_packet=512M" if(/\[mysqld\]/);' /etc/my.cnf
service mysqld restart || systemctl restart mariadb
mysql -uroot -pnagiosxi nagiosxi --max_allowed_packet=512M --force < nagiosxi.mysql
mysql -u root -pnagiosxi -e "CREATE USER 'nagiosxi'@'localhost' IDENTIFIED BY 'n@gweb';"
mysql -u root -pnagiosxi -e "GRANT ALL ON nagiosxi.* TO 'nagiosxi'@'localhost'; FLUSH PRIVILEGES;"
cp -p /usr/local/nagiosxi/html/config.inc.php /usr/local/nagiosxi/html/config.inc.php.backup
sed -i 's/pgsql/mysql/' /usr/local/nagiosxi/html/config.inc.php
mv /usr/local/nagiosxi/html/includes/components/nagiosim ~/nagiosim.backup &>/dev/null
service postgresql stop || systemctl stop postgresql
chkconfig postgresql off || systemctl disable postgresql
Which worked.
However prior to the migration my actions component

Code: Select all

/administrator/systemextentions/manage components/ACTIONS
contained 201 custom actions.
After the migration :
Capture.PNG
Also, an issue that I had , which got resolved in this post:

Code: Select all

https://support.nagios.com/forum/viewtopic.php?f=16&t=51587
returned.

In order to test my theory I ran these commands to reverse the postgresql migration:

Code: Select all

service postgresql start 
sudo cp -p /usr/local/nagiosxi/html/config.inc.php /usr/local/nagiosxi/html/config.inc.php.attempted
sudo cp -p /usr/local/nagiosxi/html/config.inc.php.backup /usr/local/nagiosxi/html/config.inc.php
and my actions component contained the 201 custom commands again.
I also had to reapply the fix for the wproc issue after reversing the migration .
So I have come to the conclusion that migrating from postgreql to mysql is what caused me to lose the info in the actions component.
You do not have the required permissions to view the files attached to this post.
Proudly running:
NagiosXI 5.4.12 2 node Prod Env 2500 hosts, 13,000 services
Nagiosxi 5.5.7(test env) 2500 hosts, 13,000 services
Nagios Logserver 2 node Prod Env 500 objects sending
Nagios Network Analyser
Nagios Fusion
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: migrating psql to my sql. custom actions componet info l

Post by ssax »

Likely has issues with escaping, please run these commands and PM me the resulting nagiosxi.psql and the nagiosxi.psql2 files:

Code: Select all

pg_dump --no-acl --no-owner --format p --data-only -U nagiosxi nagiosxi > nagiosxi.psql
pg_dump -U nagiosxi nagiosxi > nagiosxi.psql2
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: migrating psql to my sql. custom actions componet info l

Post by ssax »

Sorry, please run this one and send me the resulting /tmp/nagiosxi.psql3 file

Code: Select all

pg_dump -U nagiosxi -c nagiosxi > /tmp/nagiosxi.psql3
Locked