Permalink
Browse files

Fix missing args on SBC Temp and Inet Speed at init

  • Loading branch information...
NEMS Linux
NEMS Linux committed Jan 1, 2019
1 parent 6f595e9 commit 6c429f747cd0f9aedc254672f6d649971f191630
Showing with 53 additions and 220 deletions.
  1. +25 −0 helpers/nems-conf-to-cfg.sh
  2. +9 −4 { → helpers}/nems-db-to-cfg.sh
  3. +1 −1 nems-cleanup.sh
  4. +14 −3 nems-push-db.sh
  5. +0 −208 nems-push-db~working.sh
  6. +4 −4 nems-restore-sample-db.sh
@@ -0,0 +1,25 @@
#!/bin/bash
# Convert NEMS Nconf Database to Nagios Config files.
# Used to create the default reconciliation files

# Automatically replaces the config files in NEMS Migrator any time you update NEMS-Sample mysql db (so they match)

dest=/root/nems/nems-migrator/data/1.5/nagios/conf

echo ""
echo "Ready to copy your /etc/nems/conf folder. Please open NConf and Generate Config."

read -n 1 -s -r -p "Generate Config and press any key to continue"

if [[ ! -d $dest ]]; then
mkdir -p $dest
else
rm -rf $dest
mkdir -p $dest
fi
cd $dest

cp -R /etc/nems/conf/Default_collector $dest
cp -R /etc/nems/conf/global $dest

echo Done. Files in $dest have been updated.
@@ -4,11 +4,16 @@

# Automatically replaces the config files in NEMS Migrator any time you update NEMS-Sample mysql db (so they match)

dest=/root/nems/nems-migrator/data/1.5/nagios/conf
dest=/root/nems/nems-migrator/data/1.5/nconf/confdump

if [[ ! -d $dest ]]; then
mkdir $dest
mkdir -p $dest
else
rm -rf $dest
mkdir -p $dest
fi
cd $dest

if [[ ! -d 'global' ]]; then
mkdir global
fi
@@ -20,9 +25,9 @@ fi
/var/www/nconf/bin/get_items.pl -c timeperiod -f > $dest/global/timeperiods.cfg
/var/www/nconf/bin/get_items.pl -c misccommand -f > $dest/global/misccommands.cfg
/var/www/nconf/bin/get_items.pl -c checkcommand -f > $dest/global/checkcommands.cfg
#/var/www/nconf/bin/get_items.pl -c contact -f > $dest/global/contacts.cfg
/var/www/nconf/bin/get_items.pl -c contact -f > $dest/global/contacts.cfg
# Use the default contact from NEMS 1.4 instead
cp -f /root/nems/nems-migrator/data/1.4/nagios/conf/global/contacts.cfg /root/nems/nems-migrator/data/1.5/nagios/conf/global/contacts.cfg
# cp -f /root/nems/nems-migrator/data/1.4/nagios/conf/global/contacts.cfg /root/nems/nems-migrator/data/1.5/nagios/conf/global/contacts.cfg
/var/www/nconf/bin/get_items.pl -c contactgroup -f > $dest/global/contactgroups.cfg
/var/www/nconf/bin/get_items.pl -c host-template -f > $dest/global/host_templates.cfg
/var/www/nconf/bin/get_items.pl -c service-template -f > $dest/global/service_templates.cfg
@@ -177,7 +177,7 @@ nameserver 2001:4860:4860::8844
# Import default Nagios configs
rm -rf /etc/nems/conf
mkdir /etc/nems/conf
cp -R /root/nems/nems-migrator/data/1.4/nagios/conf/* /etc/nems/conf/
cp -R /root/nems/nems-migrator/data/1.5/nagios/conf/default/* /etc/nems/conf/
if [[ ! -d /etc/nems/conf/okconfig ]]; then
mkdir /etc/nems/conf/okconfig
fi
@@ -14,13 +14,24 @@ echo If you see an error, press CTRL-C immediately!!
systemctl stop nagios
sleep 5

# Convert the database to new default config files (for reconciliation)
/root/nems/nems-admin/helpers/nems-db-to-cfg.sh

# Copy the active config for use as default at init
systemctl start nagios
/root/nems/nems-admin/helpers/nems-conf-to-cfg.sh
systemctl stop nagios

echo Starting Nagios.
systemctl start nagios
echo If you see an error, press CTRL-C immediately!!
systemctl stop nagios
sleep 5

echo "DO NOT press CTRL-C from this point forward (will leave system broken)"

sleep 3

# Convert the database to new default config files (for reconciliation)
/root/nems/nems-admin/nems-db-to-cfg.sh


# Proceed with DB conversion and migration

This file was deleted.

Oops, something went wrong.
@@ -18,10 +18,10 @@ rm -rf /etc/nems/conf/Default_collector
rm -rf /etc/nems/conf/global
cp -R /root/nems/nems-migrator/data/$version/nagios/conf/* /etc/nems/conf/
# Import the live configs (sample data from dump)
rm /etc/nems/conf/Default_collector/advanced_services.cfg
mv /etc/nems/conf/Default_collector/advanced_services_sample.cfg /etc/nems/conf/Default_collector/advanced_services.cfg
rm /etc/nems/conf/global/service_templates.cfg
mv /etc/nems/conf/global/service_templates_sample.cfg /etc/nems/conf/global/service_templates.cfg
#rm /etc/nems/conf/Default_collector/advanced_services.cfg
#mv /etc/nems/conf/Default_collector/advanced_services_sample.cfg /etc/nems/conf/Default_collector/advanced_services.cfg
#rm /etc/nems/conf/global/service_templates.cfg
#mv /etc/nems/conf/global/service_templates_sample.cfg /etc/nems/conf/global/service_templates.cfg
# Set ownership
chown -R www-data:www-data /etc/nems/conf/Default_collector
chown -R www-data:www-data /etc/nems/conf/global

0 comments on commit 6c429f7

Please sign in to comment.