Skip to content

Commit dc25225

Browse files
committed
Installation Notes
1 parent 249cd68 commit dc25225

4 files changed

Lines changed: 422 additions & 0 deletions

File tree

Selenium Notes.txt

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
selenium webdriver
2+
3+
create maven project
4+
--> src/main folder
5+
--> create a package
6+
7+
--> create a new class --myfirstTestcase
8+
9+
public class MyfirstTC{
10+
11+
public static void main(String[] args) throws InterruptedException {
12+
// TODO Auto-generated method stub
13+
14+
15+
16+
WebDriver driver = new ChromeDriver();
17+
18+
driver.manage().window().maximize();
19+
20+
driver.get("https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Selenium+%28software%29");
21+
22+
Thread.sleep(2000);
23+
24+
driver.findElement(By.id("wpName2")).sendKeys("sonal"
25+
26+
// Now use XPATH to write the locator value.
27+
28+
// Add wait time
29+
30+
}
31+
32+
}
33+
34+
35+
36+
--> create another new class for testNG --> wikitestcase
37+
38+
public class WikiTestCase {
39+
40+
public static WebDriver driver;
41+
42+
@BeforeClass
43+
public static void setup()
44+
{
45+
46+
System.setProperty("webdriver.chrome.driver", "C:\\Users\\vishal mittal\\Downloads\\chromedriver_win32 (12)\\chromedriver.exe");
47+
48+
driver = new ChromeDriver();
49+
50+
driver.manage().window().maximize(); // maximize the browser window
51+
52+
driver.manage().deleteAllCookies(); // delete cookies on the browser
53+
54+
55+
56+
driver.get("https://en.wikipedia.org/w/index.php?title=Special:CreateAccount&returnto=Selenium +%28software%29");
57+
58+
driver.manage().timeouts().pageLoadTimeout(10, TimeUnit.SECONDS);
59+
// implicit wait
60+
61+
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
62+
63+
64+
65+
}
66+
@Test(priority='1')
67+
public void createAccount() throws InterruptedException
68+
{
69+
// test steps to perform testcase goes here
70+
71+
72+
driver.findElement(By.id("wpName2")).sendKeys("Username1");
73+
74+
Thread.sleep(3000);
75+
76+
// Inspect password textbox and enter data in the text box
77+
driver.findElement(By.name("wpPassword")).sendKeys("password@123");
78+
79+
WebElement e= driver.findElement(By.xpath("//button[@value='Create your account']"));
80+
81+
// if we add
82+
83+
Thread.sleep(10000);// waiting until 10 seconds
84+
85+
e.click();
86+
87+
}
88+
89+
@AfterClass
90+
public void closebrowser()
91+
{
92+
driver.close();
93+
}
94+
95+
***********************************************
96+
97+
TestNG.xml
98+
99+
Create folder src/main/resources
100+
101+
Create a file with extension .xml
102+
103+
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd" >
104+
105+
<suite name="8PMproject" verbose="1" >
106+
<test name="Selenium scripts" >
107+
<classes>
108+
<class name="packagename.classname" />
109+
110+
</classes>
111+
</test>
112+
</suite>
113+
114+
115+
116+
Now run the projects as Run As--> MAVEN Test
117+
118+
****************************************************
119+
120+
Upload in git
121+
122+
Show in jenkins.
123+
124+
125+
126+
127+

Swam playbook.txt

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
- hosts: docker-manager-first
2+
remote_user: root
3+
become: yes
4+
tasks:
5+
- name: "create primary swarm manager"
6+
shell: docker swarm init --advertise-addr {{ipaddress }}
7+
8+
- name: "get docker swarm manager token"
9+
shell: docker swarm join-token -q manager
10+
register: manager_token
11+
12+
- name: "get docker swarm worker token"
13+
shell: docker swarm join-token -q worker
14+
register: worker_token
15+
16+
- hosts: docker-managers
17+
remote_user: root
18+
become: yes
19+
tasks:
20+
- name: "join as a manager"
21+
shell: "docker swarm join --token {{ hostvars['manager1']['manager_token']['stdout'] }} {{ hostvars['manager1']['ansible_eth0']['ipv4']['address'] }}:2377"
22+
when: docker_info.stdout.find("Swarm{{':'}} inactive") != -1
23+
retries: 3
24+
delay: 20
25+
26+
- hosts: docker-workers
27+
remote_user: root
28+
become: yes
29+
become_method: sudo
30+
tasks:
31+
- name: "join as a worker"
32+
shell: "docker swarm join --token {{ hostvars['manager1']['worker_token']['stdout'] }} {{ hostvars['manager1']['ansible_eth0']['ipv4']['address'] }}:2377"
33+
when: "docker_info.stdout.find('Swarm: inactive') != -1"
34+
retries: 3
35+
delay: 20

nagios installation.txt

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
On NagiosServer:
2+
3+
1 yum install httpd php gcc glibc glibc-comman gd gd-devel make net-snmp unzip -y
4+
3 wget https://sourceforge.net/projects/nagios/files/nagios-4.x/nagios-4.3.2/nagios-4.3.2.tar.gz
5+
4 wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz
6+
5 tar -zxvf nagios-4.3.2.tar.gz
7+
6 tar -zxpvf nagios-plugins-2.2.1.tar.gz
8+
7 useradd nagios
9+
8 passwd nagios
10+
9 groupadd nagcmd
11+
10 usermod -G nagcmd nagios
12+
11 usermod -G nagcmd apache
13+
12 cd nagios-4.3.2
14+
13 ./configure --with-command-group=nagcmd
15+
14 make all
16+
15 make install
17+
16 make install-init
18+
17 make install-commandmode
19+
18 make install-config
20+
19 make install-webconf
21+
20 htpasswd -s -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
22+
//21 vi /usr/local/nagios/etc/objects/contacts.cfg
23+
22 systemctl restart httpd
24+
23 cd ..
25+
24 cd nagios-plugins-2.2.1/
26+
25 ./configure --with-nagios-user=nagios --with-nagios-group=nagios
27+
26 make
28+
27 make install
29+
28 /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
30+
29 systemctl enable nagios
31+
30 systemctl start nagios
32+
31 systemctl restart httpd
33+
systemctl restart nagios
34+
open the browser http://ip address/nagios
35+
uid:nagiosadmin(set in the previous steps)
36+
pwd:
37+
38+
On Nagios Host (linux):
39+
7 rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
40+
8 yum install nrpe nagios-plugins-all -y
41+
9 vim /etc/nagios/nrpe.cfg
42+
In this file,
43+
uncomment server address,
44+
and remove the value for current server adress
45+
and add the private ip of you nagios server as
46+
Server address=172.31.40.7
47+
48+
add private ip of nagios server under
49+
50+
allowed_hosts=172.31.40.7
51+
52+
53+
10 systemctl enable nrpe
54+
11 systemctl start nrpe
55+
56+
Go to nagios server
57+
58+
In nigios.cfg
59+
60+
# vim nagios.cfg
61+
uncomment this dire : /usr/local/nagios/etc/servers
62+
63+
etc] # mkdir servers
64+
] # cd servers/
65+
# ls
66+
# cp /usr/local/nagios/etc/objects/localhost.cfg ip-172-31-22-220.us-east-2.compute.internal.cfg
67+
68+
copy the localhost.cfg file from objects directory and create file with name as
69+
privatehostanameofNagiosHost.cfg
70+
71+
# ls
72+
73+
privatehostanameofNagiosHost.cfg file will be there. copy it
74+
75+
# vim privatehostanameofNagiosHost.cfg
76+
77+
Inside this file make follwoing chnages:
78+
Under
79+
define host{
80+
81+
add host_name= privatehostname of nagioshost
82+
alias = privatehostname of nagioshost
83+
address = private ip of host
84+
}
85+
86+
under chnage linuxservers to linux server
87+
88+
define hostgroup{
89+
90+
hostgroup_name= linuxserver
91+
alias = linux server
92+
memeber = privatehostname of nagioshost
93+
}
94+
95+
in all services definitions change
96+
host_name= privatehostname of nagioshost
97+
}
98+
99+
:wq!
100+
101+
# now restart nagios
102+
103+
systemctl restart nagios
104+
105+
go to web view of nagios and see new linux machine is added.
106+
107+
This is how you can monitor a windows and linux machine
108+
109+
Go to HOST machine
110+
111+
*********************************
112+
113+
114+
Install docker
115+
116+
# yum install docker -y
117+
118+
# systemctl start docker
119+
120+
# docker run -itd -P nginx
121+
122+
# docker ps
123+
124+
note the port number
125+
126+
go to browser
127+
128+
public ip of host :portnumber
129+
130+
container created and app running
131+
132+
Now let us monitor this app using nagios
133+
134+
Go to Nagios SERVER
135+
136+
*******************
137+
138+
Go to following location:
139+
140+
servers] # cd..
141+
objects] # cd..
142+
etc] # cd ..
143+
nagios] # ls
144+
145+
# cd libexec
146+
147+
# ls
148+
149+
You will see all the default plugins running
150+
151+
to monitor an application. use the plugin ./check_http
152+
153+
# ./check_http -I 18.222.209.193 -p 32768
154+
155+
# ./check_http -v // give all options to use with this plugin
156+
157+
# ./check_tcp -H 172.31.44.151 -v -p 8888 -N http://3.21.41.81:8888/addressbook/
158+
159+
// adress book
160+
161+
http://3.21.41.81:8888/addressbook/
162+
163+
164+
165+
************************************
166+
167+
WINDOWS MACHINE SETUP
168+
169+
***********************************
170+
171+
After installation
172+
173+
go to
174+
cd /usr/local/nagios
175+
ls
176+
cd etc
177+
ls
178+
179+
You will see file nagios.cfg
180+
181+
# vim nagios.cfg
182+
183+
Uncomment this line:
184+
185+
# Definitions for monitoring a Windows machine
186+
cfg_file=/usr/local/nagios/etc/objects/windows.cfg
187+
188+
Now go to objects directory
189+
190+
# cd objects/
191+
ls
192+
vim windows.cfg
193+
194+
go to cmd prompt
195+
ipconfig
196+
197+
IPv4 Address. . . . . . . . . . . : 192.168.1.4
198+
199+
C:\Users\vishal mittal>hostname
200+
LAPTOP-N0G0NBDP
201+
202+
203+
In the windows.cfg file change
204+
205+
address = 192.168.1.4
206+
207+
host_name = LAPTOP-N0G0NBDP
208+
209+
210+
save the file
211+
212+
# systemctl restart nagios
213+
systemctl restart httpd
214+
systemctl restart nagios
215+
216+
go to web :http://3.139.73.88/nagios/
217+
218+
hosts
219+
laptop will be available for monitoring
220+
221+

0 commit comments

Comments
 (0)