-
Notifications
You must be signed in to change notification settings - Fork 324
Expand file tree
/
Copy pathnagios_installation.txt
More file actions
144 lines (123 loc) · 5.71 KB
/
nagios_installation.txt
File metadata and controls
144 lines (123 loc) · 5.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
root
LAMP configuration:
Linux
2 useradd nagios
3 groupadd nagcmd
30 usermod -a -G nagcmd nagios
31 id nagios
32 yum install gcc glibc glibc-common gd gd-devel make net-snmp openssl-devel xinetd unzip
33 visudo
in that find root using (/root) and enter nagios ALL=(ALL) NOPASSWD:ALL
APACHE
34 yum install httpd
35 systemctl start httpd.service
36 systemctl status httpd
37 systemctl enable httpd.service // after reboot service will start automatically
38 chkconfig --list | grep -i http // this is old command not used for centos7
40 yum install elinks
41 elinks http://192.168.146.167 // to view this in command promt
45 curl http://icanhazip.com // this command not required
MYSQL(MariaDB)
46 yum install mariadb-server mariadb
47 systemctl start mariadb
48 systemctl status mariadb
49 systemctl enable mariadb
50 mysql_secure_installation Devops@123
in this step it will ask to enter root password (first enter AND GIVE NEW password)
51 systemctl enable mariadb.service
PHP
52 yum install php php-mysql
53 systemctl restart httpd.service
54 yum search php- // this option used to search fir example
55 yum info php-fpm
56 yum install php-fpm
57 vi /var/www/html/info.php // in that enter <?php phpinfo(); ?>
58 <?php phpinfo(); ?>
58 firewall-cmd --permanent --zone=public --add-service=http
59 firewall-cmd --permanent --zone=public --add-service=https
60 firewall-cmd --reload
61 iptables -L // this is used to view the opened firewall port
62 elinks http://192.168.127.129/info.php
su - nagios
Package download/extraction and installation
0 su - nagios
1 cd ~
2 curl -L -O https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.1.1.tar.gz
3 ls -ltr // this command used to view the list all the files
4 tar xvf nagios-*.tar.gz // this used for unzip the tar.gz
5 ls -ltr // this command used to view the list all the files
6 cd nagios-*
7 ./configure --with-command-group=nagcmd
8 sudo make all // *compile codes
9 sudo make install // *install packages
11 sudo make install-commandmode
12 sudo make install-init
13 sudo make install-config
14 sudo make install-webconf
15 sudo usermod -G nagcmd apache
16 id apache
17 cd ~
18 curl -L -O http://nagios-plugins.org/download/nagios-plugins-2.1.1.tar.gz //* download nagios plugins
19 ls -ltr
20 tar xvf nagios-plugins-*.tar.gz
21 ls -ltr
22 cd nagios-plugins-2.1.1
23 ./configure --with-nagios-user=nagios --with-nagios-group=nagios --with-openssl
24 make // to compile code
25 sudo make install
26 cd ~
27 curl -L -O http://downloads.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz // nagios remote plugin executor installation
28 tar xvf nrpe-*.tar.gz
30 cd nrpe-*
31 ./configure --enable-command-args --with-nagios-user=nagios --with-nagios-group=nagios --with-ssl=/usr/bin/openssl --with-ssl-lib=/usr/lib/x86_64-linux-gnu
32 make all
33 sudo make install
34 sudo make install-xinetd
35 sudo make install-daemon-config
36 sudo vi /etc/xinetd.d/nrpe // in this give nagios server IP
37 sudo service xinetd restart
38 sudo vi /usr/local/nagios/etc/nagios.cfg // in this remove ash tag(#)before cfg_dir // #cfg_dir=/usr/local/nagios/etc/servers
39 sudo mkdir /usr/local/nagios/etc/servers // here client ip want to enter
40 sudo vi /usr/local/nagios/etc/objects/contacts.cfg // here can configure the mail addres to sent auto mail
41 sudo vi /usr/local/nagios/etc/objects/commands.cfg //
define command{
command_name check_nrpe
command_line $USER1$/check_nrpe -H $HOSTADDRESS$ -c $ARG1$
}
42 sudo htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
43 sudo systemctl daemon-reload
44 sudo systemctl start nagios.service
45 sudo systemctl restart httpd.service
46 sudo chkconfig nagios on
47 find / -name nagios
48 sudo vi /etc/httpd/conf.d/nagios.conf // (enter Server address IP address next allowed_hosts=127.0.0.1,10.132.224.168 )
49 sudo systemctl restart nagios.service
50 sudo systemctl restart httpd.service
Client Nagios Installation
2 yum install epel-release // extra packages
3 yum repolist
4 yum install nrpe nagios-plugins-all
5 vi /etc/nagios/nrpe.cfg
6 sudo systemctl start nrpe.service
7 sudo systemctl enable nrpe.service
**************************SERVER********************************************************
sudo vi /usr/local/nagios/etc/servers/yourhost.cfg // in this location create host name.cfg in server
define host {
use linux-server
host_name yourhost (client HOST NAME)
alias My first Apache server
address 10.132.234.52 (CLIENT IP)
max_check_attempts 5
check_period 24x7
notification_interval 30
notification_period 24x7
}
sudo systemctl reload nagios.service
******************************************************************************
to slove the check_http error: "HTTP WARNING: HTTP/1.1 403 Forbidden"
sudo touch /var/www/html/index.html
sudo systemctl restart nagios.service
sudo systemctl restart httpd.service
https://www.digitalocean.com/community/tutorials/how-to-install-nagios-4-and-monitor-your-servers-on-centos-7
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/toc.html
https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/configmain.html#check_external_commands