ScanCore: Difference between revisions

From Alteeve Wiki
Jump to navigation Jump to search
Line 27: Line 27:


<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
chkconfig postgresql on
/etc/init.d/postgresql start
/etc/init.d/postgresql start
</syntaxhighlight>
</syntaxhighlight>

Revision as of 15:37, 5 March 2015

 AN!Wiki :: How To :: ScanCore

Warning: This is little more that raw notes, do not consider anything here to be valid or accurate at this time.

Installing

PostgreSQL Setup

yum install -y postgresql postgresql-server postgresql-plperl postgresql-contrib postgresql-libs Scanner
...
Complete!

DB config:

/etc/init.d/postgresql initdb
Initializing database:                                     [  OK  ]

Start

chkconfig postgresql on
/etc/init.d/postgresql start
Starting postgresql service:                               [  OK  ]

Create the striker user.

su - postgres -c "createuser --no-superuser --createdb --no-createrole striker"
# no output expected

Set 'postgres' and 'striker' user passwords:

su - postgres -c "psql -U postgres"
psql (8.4.20)
Type "help" for help.
postgres=# \password
Enter new password: 
Enter it again:
postgres=# \password striker
Enter new password: 
Enter it again:

Exit.

postgres=# \q
Warning: In the below example, the BCN is 10.20.0.0/16 and the IFN is 192.168.199.0/24. If you have different networks, be sure to adjust your values accordingly!

Configure access:

cp /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf.striker
vim /var/lib/pgsql/data/pg_hba.conf
diff -u /var/lib/pgsql/data/pg_hba.conf.striker /var/lib/pgsql/data/pg_hba.conf
--- /var/lib/pgsql/data/pg_hba.conf.striker	2015-03-05 14:33:40.902733374 +0000
+++ /var/lib/pgsql/data/pg_hba.conf	2015-03-05 14:34:44.861733318 +0000
@@ -65,9 +65,13 @@
 
 
 # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
+# dashboards
+host    all         all         192.168.199.0/24      md5
+# node servers
+host    all         all         10.20.0.0/16          md5
 
 # "local" is for Unix domain socket connections only
-local   all         all                               ident
+local   all         all                               md5
 # IPv4 local connections:
 host    all         all         127.0.0.1/32          ident
 # IPv6 local connections:
cp /var/lib/pgsql/data/postgresql.conf /var/lib/pgsql/data/postgresql.conf.striker
vim /var/lib/pgsql/data/postgresql.conf
diff -u /var/lib/pgsql/data/postgresql.conf.striker /var/lib/pgsql/data/postgresql.conf
--- /var/lib/pgsql/data/postgresql.conf.striker	2015-03-05 14:35:35.388733307 +0000
+++ /var/lib/pgsql/data/postgresql.conf	2015-03-05 14:36:07.111733159 +0000
@@ -56,7 +56,7 @@
 
 # - Connection Settings -
 
-#listen_addresses = 'localhost'		# what IP address(es) to listen on;
+listen_addresses = '*'			# what IP address(es) to listen on;
 					# comma-separated list of addresses;
 					# defaults to 'localhost', '*' = all
 					# (change requires restart)
/etc/init.d/postgresql restart
Stopping postgresql service:                               [  OK  ]
Starting postgresql service:                               [  OK  ]

Striker Database Setup

Create DB:

su - postgres -c "createdb --owner striker scanner"
Password:

The SQL files we need to load are found in the /etc/striker/SQL directory.

The core SQL file is

ls -lah /etc/striker/SQL/
total 64K
drwxr-xr-x. 2 root root 4.0K Mar  4 23:50 .
drwxr-xr-x. 5 root root 4.0K Mar  4 23:50 ..
-rw-r--r--. 1 root root  397 Mar  4 23:41 00_drop_db.sql
-rw-r--r--. 1 root root 2.5K Mar  4 23:41 01_create_node.sql
-rw-r--r--. 1 root root 3.2K Mar  4 23:41 02_create_alerts.sql
-rw-r--r--. 1 root root 1.9K Mar  4 23:41 03_create_alert_listeners.sql
-rw-r--r--. 1 root root 1.3K Mar  4 23:41 04_load_alert_listeners.sql
-rw-r--r--. 1 root root 3.2K Mar  4 23:41 05_create_random_agent.sql
-rw-r--r--. 1 root root 3.4K Mar  4 23:41 06a_create_snm_apc_pdu.sql
-rw-r--r--. 1 root root 3.6K Mar  4 23:41 06b_create_snmp_brocade_switch.sql
-rw-r--r--. 1 root root 3.4K Mar  4 23:41 06_create_snm_apc_ups.sql
-rw-r--r--. 1 root root 3.5K Mar  4 23:41 07_create_ipmi.sql
-rw-r--r--. 1 root root 5.9K Mar  4 23:41 08_create_raid.sql
-rw-r--r--. 1 root root 3.8K Mar  4 23:41 09_create_bonding.sql
-rw-r--r--. 1 root root 1.2K Mar  4 23:41 Makefile
Note: The default is that the database owner name is striker. If you used a different database name owner, please update the .sql files with the command sed -i 's/striker/yourname/' *.sql.

Load the SQL tables into the database.

cat /etc/striker/SQL/*.sql > /tmp/all.sql
psql scanner -U striker -f /tmp/all.sql
Password for user striker:
<sql load messages>

Test:

psql -U striker -d scanner -c "SELECT * FROM alert_listeners"
Password for user striker:
 id |      name      |     mode      |  level  |  contact_info  | language | added_by |            updated            
----+----------------+---------------+---------+----------------+----------+----------+-------------------------------
  1 | screen         | Screen        | DEBUG   | screen         | en_CA    |        0 | 2014-12-11 14:42:13.273057-05
  2 | Tom Legrady    | Email         | DEBUG   | tom@striker.ca | en_CA    |        0 | 2014-12-11 16:54:25.477321-05
  3 | Health Monitor | HealthMonitor | WARNING |                | en_CA    |        0 | 2015-01-14 14:08:15-05
(3 rows)

Done!

Configure Scan Core on a Node

Install dependencies:

yum install Scanner postgresql

On the clients, you need to be sure your configuration files are set the way you want.

Most importantly is that the connection details to the databases on the dashboards are configured properly. Most installs have two dashboards, and Scanner will record it's data to both for resiliency.

The configuration files are found in /etc/striker/Config/.

ls -lah /etc/striker/Config/
total 68K
drwxr-xr-x. 2 root root 4.0K Mar  5 15:06 .
drwxr-xr-x. 5 root root 4.0K Mar  5 15:06 ..
-rw-r--r--. 1 root root  741 Mar  4 23:41 bonding.conf
-rw-r--r--. 1 root root 1.1K Mar  4 23:41 dashboard.conf
-rw-r--r--. 1 root root  379 Mar  4 23:41 db.conf
-rw-r--r--. 1 root root 5.1K Mar  4 23:41 ipmi.conf
-rw-r--r--. 1 root root  939 Mar  4 23:41 nodemonitor.conf
-rw-r--r--. 1 root root 1.2K Mar  4 23:41 raid.conf
-rw-r--r--. 1 root root  961 Mar  4 23:41 scanner.conf
-rw-r--r--. 1 root root 1.7K Mar  4 23:41 snmp_apc_pdu.conf
-rw-r--r--. 1 root root 8.9K Mar  4 23:41 snmp_apc_ups.conf
-rw-r--r--. 1 root root 4.7K Mar  4 23:41 snmp_brocade_switch.conf
-rw-r--r--. 1 root root 1.4K Mar  4 23:41 system_check.conf
Note: We're showing two databases, but in theory, there is no set limit on the number of database servers that the nodes can use. Simply copy the configuration section for each additional server you wish to use. Just be sure to increment the id number for each section (ie: db::X::name where X is a unique integer for the additional server).

In this example, the two Striker dashboards with our databases have the BCN IPs 10.20.4.1 and 10.20.4.2. Both use the database name scanner owned by the database user striker with the password secret. So their configurations will be nearly identical.

cp /etc/striker/Config/db.conf /etc/striker/Config/db.conf.original
vim /etc/striker/Config/db.conf




cd Scanner/Config/
vim db.conf 
git diff db.conf
diff --git a/Scanner/Config/db.conf b/Scanner/Config/db.conf
index 9925faf..e39aa60 100644
--- a/Scanner/Config/db.conf
+++ b/Scanner/Config/db.conf
@@ -1,7 +1,6 @@
 db::1::name      = scanner
 db::1::db_type   = Pg
-db::1::host      = 10.255.4.251
-#db::1::host      = an-m01
+db::1::host      = 10.20.4.2
 db::1::port      = 5432
-db::1::user      = alteeve
-db::1::password  = alteeve
+db::1::user      = striker
+db::1::password  = secret
cd ../RPMS
./load_rpm_packages.sh
# say 'y' when prompted
cd ..
make wrapper
cd Src && make 
make[1]: Entering directory `/root/striker/Scanner/Src'
if [[ "root" != "root" ]] ; then		\
	    echo "Only root can create wrappers.";	\
	    echo "run as: sudo make";	\
	else				\
	    cc -o wipmi wipmi.c;		\
	    cp wipmi ..;			\
	    chown root:root ../wipmi;	\
	    chmod 755  ../wipmi; 		\
	    chmod u+s  ../wipmi;		\
	fi
if [[ "root" != "root" ]] ; then		\
	    echo "Only root can create wrappers.";	\
	    echo "run as: sudo make";	\
	else				\
	    cc -o wstorcli wipmi.c;		\
	    cp wstorcli ..;			\
	    chown root:root ../wstorcli;	\
	    chmod 755  ../wstorcli; 		\
	    chmod u+s  ../wstorcli;		\
	fi
make[1]: Leaving directory `/root/striker/Scanner/Src'

Test:

Agents/ipmi --verbose --verbose
ipmi loop 1 at 1421444884.53996 2378.437:27621.563 mSec.
^C

Yay!






 

Any questions, feedback, advice, complaints or meanderings are welcome.
Alteeve's Niche! Enterprise Support:
Alteeve Support
Community Support
© Alteeve's Niche! Inc. 1997-2024   Anvil! "Intelligent Availability®" Platform
legal stuff: All info is provided "As-Is". Do not use anything here unless you are willing and able to take responsibility for your own actions.