SQL database setup: Difference between revisions
(8 intermediate revisions by the same user not shown) | |||
Line 22: | Line 22: | ||
=mySQL= | =mySQL= | ||
Note that thie below steps are not needed if you have used the sql import script from the tarball.<br> | |||
*Login sample: | *Login sample: | ||
root@mylvs01:/# mysql -u root -p | root@mylvs01:/# mysql -u root -p | ||
Line 27: | Line 28: | ||
*Change the database: | *Change the database: | ||
mysql> use mylvs; | mysql> use mylvs; | ||
==Create the Database and the Users== | |||
Note that thie below steps are not needed if you have used the sql import script from the tarball.<br> | |||
Create the database, login into myslq: | |||
# mysql -u root -p | |||
On the SQL prompt type: | |||
mysql> create database mylvs; | |||
Create the default mylvs user using the password = demo: | |||
mysql> GRANT ALL PRIVILEGES ON mylvs.* TO mylvsuser@localhost IDENTIFIED BY 'demo'; | |||
Add the demo user into myLVS if not already done, table tblUsers (Already done when importing the sql script): | |||
mysql> insert into tblUsers (userID,name,operations,logview,showcon,searchcon,reset,reboot,search,whois,nslookup,scan,servermanager) values ('1','demo','1','1','1','1','1','1','1','1','1','1','1'); | |||
==Command prepare== | ==Command prepare== | ||
Note that thie below steps are not needed if you have used the sql import script from the tarball.<br> | |||
This kind of data is not covered by the myLVS web gui yet but is already imported if the mylvs.sql script has already been imported. | This kind of data is not covered by the myLVS web gui yet but is already imported if the mylvs.sql script has already been imported. | ||
mysql> INSERT INTO `tblCommands` (`cmdID`,`enabled`,`name`,`command`,`type`,`type-description`) VALUES | mysql> INSERT INTO `tblCommands` (`cmdID`,`enabled`,`name`,`command`,`type`,`type-description`) VALUES | ||
Line 37: | Line 50: | ||
==Webservice prepare== | ==Webservice prepare== | ||
Note that thie below steps are not needed if you have used the sql import script from the tarball.<br> | |||
This kind of data is not covered by the myLVS web gui yet but is already imported if the mylvs.sql script has already been imported. | This kind of data is not covered by the myLVS web gui yet but is already imported if the mylvs.sql script has already been imported. | ||
Line 46: | Line 59: | ||
(2,1,'192.168.2.222','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143230','0','0','0',0,0,'0',0,'0'); | (2,1,'192.168.2.222','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143230','0','0','0',0,0,'0',0,'0'); | ||
==myLVS Monitoring prepare== | |||
Note that the below steps are not needed if you have used the sql import script from the tarball.<br> | |||
This will show how to setup the command table for nrpe commands for | This will show how to setup the command table for nrpe commands for | ||
Line 79: | Line 92: | ||
=Remote Access= | =Remote Access= | ||
Note that thie below steps are not needed if you have used the sql import script from the tarball.<br> | |||
Insert the statements: | Insert the statements: | ||
Latest revision as of 17:49, 7 September 2015
Setup Host Header
- Windows
C:\>notepad c:\Windows\System32\drivers\etc\hosts
Set:
192.168.2.200 ws.mylvs.foo
Refresh dns cache
ipconfig /flushdns
- Linux
root@myLVS-LinuxClient:/# vi /etc/hosts
Set:
192.168.2.200 ws.mylvs.foo
root@mylvs01:/var/www/mylvs/ws/cgi-bin# chmod 777 lvs.cgi root@mylvs01:/var/www/mylvs/ws/modules# chmod 777 lvs.pm
mySQL
Note that thie below steps are not needed if you have used the sql import script from the tarball.
- Login sample:
root@mylvs01:/# mysql -u root -p
- Change the database:
mysql> use mylvs;
Create the Database and the Users
Note that thie below steps are not needed if you have used the sql import script from the tarball.
Create the database, login into myslq:
# mysql -u root -p
On the SQL prompt type:
mysql> create database mylvs;
Create the default mylvs user using the password = demo:
mysql> GRANT ALL PRIVILEGES ON mylvs.* TO mylvsuser@localhost IDENTIFIED BY 'demo';
Add the demo user into myLVS if not already done, table tblUsers (Already done when importing the sql script):
mysql> insert into tblUsers (userID,name,operations,logview,showcon,searchcon,reset,reboot,search,whois,nslookup,scan,servermanager) values ('1','demo','1','1','1','1','1','1','1','1','1','1','1');
Command prepare
Note that thie below steps are not needed if you have used the sql import script from the tarball.
This kind of data is not covered by the myLVS web gui yet but is already imported if the mylvs.sql script has already been imported.
mysql> INSERT INTO `tblCommands` (`cmdID`,`enabled`,`name`,`command`,`type`,`type-description`) VALUES (1,1,'Reset IIS','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reset_iis',2,'Reset Service'), (2,1,'Restart Apache','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reset_apache',2,'Reset Service'), (3,1,'Reboot Server','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reboot',2,'Reboot Server');
Webservice prepare
Note that thie below steps are not needed if you have used the sql import script from the tarball.
This kind of data is not covered by the myLVS web gui yet but is already imported if the mylvs.sql script has already been imported.
INSERT INTO `tblMaintenance` (`mID`,`enabled`,`ip`,`hostname`,`groupID`,`requestUP`,`requestDOWN`,`WeightDownTime`,`WeightDownPending`,`TurnOffTime`, `TurnOffPending`,`response`,`message`,`updatepending`,`requestDate`,`responseDate`,`receivedfrom`,`CurWeightDownTime`,`CurTurnOffTime`,`DSLMaintenance`, `DSLRenewRequest`,`DSLDate`,`DSLEpoche`,`DSLIP`) VALUES (1,1,'192.168.2.221','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143609','0','0','0',0,0,'0',0,'0'), (2,1,'192.168.2.222','hh',1,0,0,30,0,30,0,200,'Host has been turned on',0,'0','20150727143230','0','0','0',0,0,'0',0,'0');
myLVS Monitoring prepare
Note that the below steps are not needed if you have used the sql import script from the tarball.
This will show how to setup the command table for nrpe commands for
- reset_iis
- reset_apache
- The monitoring ID will be 1 which means that this record is offered to be used for monitoring purposes.
INSERT INTO `tblCommands` (`cmdID`,`enabled`,`name`,`command`,`type`,`type-description`) VALUES (4,1,'Check HTTP','/usr/lib/nagios/plugins/check_http -H %HOST%',1,'Check IIS');
- tblRecover
INSERT INTO `tblRecover` (`recID`,`enabled`,`name`,`command`) VALUES (1,1,'Reset IIS','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reset_iis'), (2,1,'Reset Apache','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reset_apache'), (3,1,'Reboot','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reboot');
- tblRecoverTasks
INSERT INTO `tblRecoverTasks` (`TaskID`,`recTaskID`,`recID`,`recClock`,`title`) VALUES (1,1,1,2,'Reset IIS'), (2,1,3,5,'Reset IIS'), (3,2,2,1,'Reset Apache'), (4,2,3,2,'Reset Apache');
- Messaging:
INSERT INTO `tblMessaging` (`mid`,`type`,`mailfrom`,`server`,`mailto`,`mailcc`,`mailbcc`,`title`) VALUES (1,1,'mylvs@yourdomain.com','smtp.yourdomain.com','you@yourdomain.com',NULL,NULL,'IT-Group');
Remote Access
Note that thie below steps are not needed if you have used the sql import script from the tarball.
Insert the statements:
mysql> INSERT INTO `tblCommands` (`cmdID`,`enabled`,`name`,`command`,`type`,`type-description`) VALUES (1,1,'Reset IIS','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reset_iis',2,'Reset Service'), (2,1,'Restart Apache','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reset_apache',2,'Reset Service'), (3,1,'Reboot Server','/usr/lib/nagios/plugins/check_nrpe -H %HOST% -p 5666 -c reboot',2,'Reboot Server');