-
Notifications
You must be signed in to change notification settings - Fork 2
/
INSTALL
182 lines (130 loc) · 6.12 KB
/
INSTALL
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
------------------------ License: OSI Artistic License
nagiosgraph Installation Author: (c) 2005 Soren Dossing
------------------------ Author: (c) 2008 Alan Brenner, Ithaka Harbors
Author: (c) 2010 Matthew Wall
Installation can be done automatically using the install.pl script,
or manually by copying and modifying files.
Install Pre-Requisites
----------------------
To see which pre-requisites are installed:
install.pl --check-prereq
To install pre-requisites:
Debian/Ubuntu
sudo apt-get install libcgi-pm-perl librrds-perl libgd-gd2-perl
Redhat/Fedora/CentOS
sudo yum install perl-rrdtool perl-GD
Mac OS X Homebrew
brew install rrdtool
cpan -i -f GD
cpan -i Nagios::Config
Easy Install for Nagios
-----------------------
install.pl
To see a list of options:
install.pl --help
Recipe for Manual Installation
------------------------------
These instructions assume an overlay layout, with nagios at /usr/local/nagios,
with additional notes for deployment under the Homebrew nagios package on OS X.
The Icinga 1 re-write of Nagios uses the same configuration files, so these
steps may apply by replacing the nagios paths with icinga paths, but has not
been tested.
- Extract nagiosgraph into a temporary location:
cd /tmp
tar xzvf nagiosgraph-x.y.z.tgz
- Copy the contents of etc into your preferred configuration location:
mkdir /etc/nagiosgraph
cp etc/* /etc/nagiosgraph
- Edit the perl scripts in the cgi and lib directories, modifying the
"use lib" line to point to the directory from the previous step.
vi cgi/*.cgi lib/insert.pl
- Copy insert.pl to a location from which it can be executed:
cp lib/insert.pl /usr/local/nagios/libexec
or for Homebrew:
cp lib/insert.pl /usr/local/opt/nagios/bin
- Copy CGI scripts to a script directory served by the web server:
cp cgi/*.cgi /usr/local/nagios/sbin
or for Homebrew:
cp cgi/*.cgi /usr/local/opt/nagios/cgi-bin
- Copy CSS and JavaScript files to a directory served by the web server:
cp share/nagiosgraph.css /usr/local/nagios/share
cp share/nagiosgraph.js /usr/local/nagios/share
or for Homebrew:
cp share/nagiosgraph.css /usr/local/opt/nagios/share/nagios/htdocs
cp share/nagiosgraph.js /usr/local/opt/nagios/share/nagios/htdocs
- Edit /etc/nagiosgraph/nagiosgraph.conf. Set at least the following:
logfile = /var/log/nagiosgraph.log
cgilogfile = /var/log/nagiosgraph-cgi.log
perflog = /var/nagios/perfdata.log
rrddir = /var/nagios/rrd
mapfile = /etc/nagiosgraph/map
nagiosgraphcgiurl = /nagios/cgi-bin
javascript = /nagios/nagiosgraph.js
stylesheet = /nagios/nagiosgraph.css
- Set permissions of "rrddir" (as defined in nagiosgraph.conf) so that
the *nagios* user can write to it and the *www* user can read it:
mkdir /var/nagios/rrd
chown nagios /var/nagios/rrd
chmod 755 /var/nagios/rrd
- Set permissions of "logfile" so that the *nagios* user can write to it:
touch /var/log/nagiosgraph.log
chown nagios /var/log/nagiosgraph.log
chmod 644 /var/log/nagiosgraph.log
- Set permissions of "cgilogfile" so that the *www* user can write to it:
touch /var/log/nagiosgraph-cgi.log
chown www /var/log/nagiosgraph-cgi.log
chmod 644 /var/log/nagiosgraph-cgi.log
- Ensure that the *nagios* user can create and delete perfdata files:
chown nagios /var/nagios
chmod 755 /var/nagios
- In the Nagios configuration file (nagios.cfg) add this:
process_performance_data=1
service_perfdata_file=/var/nagios/perfdata.log
service_perfdata_file_template=$LASTSERVICECHECK$||$HOSTNAME$||$SERVICEDESC$||$SERVICEOUTPUT$||$SERVICEPERFDATA$
service_perfdata_file_mode=a
service_perfdata_file_processing_interval=30
service_perfdata_file_processing_command=process-service-perfdata
- In the Nagios commands file (commands.cfg) add this:
define command {
command_name process-service-perfdata
command_line /usr/local/nagios/libexec/insert.pl
}
- Check the nagios configuration
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- Restart nagios
/etc/init.d/nagios restart
- Verify that nagiosgraph is working by running showconfig.cgi
http://server/nagios/cgi-bin/showconfig.cgi
- Try graphing some data by running show.cgi
http://server/nagios/cgi-bin/show.cgi
- In the Nagios configuration, add a template for graphed services:
define service {
name graphed-service
action_url /nagiosgraph/cgi-bin/show.cgi?host=$HOSTNAME$&service=$SERVICEDESC$' onMouseOver='showGraphPopup(this)' onMouseOut='hideGraphPopup()' rel='/nagiosgraph/cgi-bin/showgraph.cgi?host=$HOSTNAME$&service=$SERVICEDESC$&period=week&rrdopts=-w+450+-j
register 0
}
- Enable graph links for services by appending the graphed-service to existing
service definitions in the Nagios configuration:
define service {
use local-service,graphed-service
...
}
- Replace the Nagios action icon with the nagiosgraph graph icon:
mv /usr/local/nagios/share/images/action.gif /usr/local/nagios/share/images/action.gif-orig
cp share/graph.gif /usr/local/nagios/share/images/action.gif
- In the nagiosgraph SSI file, set the URL for nagiosgraph.js:
vi share/nagiosgraph.ssi
src="/nagiosgraph/nagiosgraph.js" -> src="/nagios/nagiosgraph.js"
- Install the nagiosgraph SSI file:
cp share/nagiosgraph.ssi /usr/local/nagios/share/ssi/common-header.ssi
- Add links to graphs in the Nagios sidebar (side.php or side.html):
<ul>
<li><a href="/nagios/cgi-bin/show.cgi" target="main">Graphs</a></li>
<li><a href="/nagios/cgi-bin/showhost.cgi" target="main">Graphs by Host</a></li>
<li><a href="/nagios/cgi-bin/showservice.cgi" target="main">Graphs by Service</a></li>
<li><a href="/nagios/cgi-bin/showgroup.cgi" target="main">Graphs by Group</a></li>
</ul>
- Check the nagios configuration
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg
- Restart nagios
/etc/init.d/nagios restart