References: exercises-cacti-from-source.txt

File exercises-cacti-from-source.txt, 8.1 KB (added by admin, 7 years ago)
Line 
1Network Management & Monitoring
2
3Installing Cacti
4================
5
6Notes:
7------
8* Commands preceded with "$" imply that you should execute the command as
9  a general user - not as root.
10* Commands preceded with "#" imply that you should be working as root.
11* Commands with more specific command lines (e.g. "RTR-GW>" or "mysql>")
12  imply that you are executing commands on remote equipment, or within
13  another program.
14
15Exercises
16---------
17
181. Installing Cacti from Source
19
20Optional
21--------
22
232. Installing the Cacti Plugin Architecture
243. Install the Settings and thold Plugins
254. Configure the Installed Plugins
26
271. Installing Cacti from Source
28-------------------------------
29
30Connect to your PC using ssh
31
32Be sure we have installed the support packages required for Cacti
33
34Chances are most of these packages are already installed, but it's fine to
35specify them again as the apt package management system will only install
36new items.
37
38        $ sudo apt-get install apache2 php5 libapache2-mod-php5 mysql-server \
39          php5-mysql snmp php5-snmp rrdtool librrdp-perl librrds-perl php5-cli \
40          wget
41         
42If installing from scratch it is 110MB of additional disk space and about 61MB
43to download. Remember that "\" simply means "newline" - Ask your instructor for help if
44you don't understand what this means.
45
46Let's become root (you can use "sudo" instead if you wish).
47
48        # sudo bash
49        # cd /var/www
50        # wget http://www.cacti.net/downloads/cacti-0.8.7g.tar.gz
51
52If not available remotely or connection is too slow, then:
53
54        # wget http://noc.ws.nsrc.org/downloads/cacti/cacti-0.8.7h.tar.gz
55
56Next extract the file:
57
58        # tar xvzf cacti-0.8.7h.tar.gz
59
60Make the directory name more friendly.
61
62        # mv cacti-0.8.7h cacti
63
64Set the appropriate permissions on cacti's directories for graph/log generation.
65
66        # chown www-data:www-data cacti
67        # cd cacti
68        # chown -R www-data:www-data *
69
70Create the MySQL database
71-------------------------
72
73        # mysqladmin --user=root -p create cacti
74        Enter password: <class password>
75
76        Import the default cacti database
77
78        # mysql -uroot -p cacti < cacti.sql
79        Enter password: <class password>
80
81Create a MySQL username and password for Cacti (avoid using mysql root user)
82----------------------------------------------------------------------------
83
84        # mysql -uroot -p mysql
85        Enter password: <class password>
86
87        mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY '<class password>';
88
89        mysql> flush privileges;
90        mysql> quit
91
92Edit include/config.php and specify the MySQL user, password and database for your Cacti
93configuration. Most likely you'll only need to change the line with "$database_password"
94in the first section:
95
96        /* make sure these values refect your actual database/host/user/password */
97        $database_type = "mysql";
98        $database_default = "cacti";   
99        $database_hostname = "localhost";
100        $database_username = "cactiuser";
101        $database_password = "<class password>";
102        $database_port = "3306";
103        $database_ssl = false;
104
105Now add a line just under the line above and add the following:
106
107        /*
108        Edit this to point to the default URL of your Cacti install
109        ex: if your cacti install as at http://serverip/cacti/ this
110        would be set to /cacti/
111        */
112        $url_path = "/cacti/";
113
114Now exit and save the file.
115
116Create a cron process for cacti:
117
118        # cd /etc/cron.d
119        # touch cacti
120        # vi cacti
121
122        MAILTO=root
123        */5 * * * * www-data php /var/www/cacti/poller.php >/dev/null 2>/var/log/cacti/poller-error.log
124
125Now give the right permissions to the log files and create a blank log file:
126
127        # cd /var/log
128        # mkdir cacti
129        # chown www-data:www-data cacti
130        # cd cacti
131        # touch poller-error.log
132        # chown www-data:www-data poller-error.log
133
134Congratuations! The Cacti base is now installed. To complete installation return to the class
135presentation and follow the steps for completing the Cacti installation by going to:
136
137        http://pcN.ws.nsrc.org/cacti
138
139In a web browser.
140
141
142
143Optional Exercises
144==================
145 
146NOTE: The exercises should _only_ be done if you have installed Cacti from source. If you install
147Cacti using "apt-get install cacti" these exercises will not work.
148
149 
1502. Install the Cacti Plugin Architecture
151----------------------------------------
152
153The Cacti Plugin Architecture is a set of patches that are made to the Cacti source that allows
154users to write extensions to Cacti to add additional funcationality to the product. For the
155complete, official documenation for install the Cacti Plugin Architecture (Cacti PA) you can view
156this web page:
157
158        http://docs.cacti.net/manual:087:1_installation.9_pia
159
160First we need to obtain the Plugin Architecture source:
161
162        # cd /usr/local/src
163        # wget http://www.cacti.net/downloads/pia/cacti-plugin-0.8.7h-PA-v3.0.tar.gz
164
165If not available remotely or connection is too slow, then:
166
167        # wget http://noc.ws.nsrc.org/downloads/cacti/cacti-plugin-0.8.7h-PA-v3.0.tar.gz
168
169Next extract the file:
170
171        # tar xvzf cacti-plugin-0.8.7h-PA-v3.0.tar.gz
172
173We are going to use the patch method to install the architecture. Let's make sure that the "patch"
174utility is installed:
175
176        # apt-get install patch
177
178Copy the "diff" file to the directory where Cacti is installed:
179
180        # cd cacti-plugin-arch
181        # cp cacti-plugin-0.8.7h-PA-v3.0.diff /var/www/cacti/.
182
183Let's see if the patch file we have will work against our installation:
184
185        # cd /var/www/cacti
186        # patch -p1 -N --dry-run < cacti-plugin-0.8.7h-PA-v3.0.diff
187
188You should not see any FAIL statements on the screen. If you do, let your instructor know.
189
190Now update Cacti with the Plugin Architecture:
191
192        # patch -p1 -N < cacti-plugin-0.8.7h-PA-v3.0.diff
193
194At this point you are almost done with the initial install. We need to update a couple of files
195and add some changes to our backend Cacti MySQL database structure.
196
197First, let's update the MySQL database:
198
199        # cd /usr/local/src/cacti-plugin-arch/
200        # mysql -uroot -p cacti < pa.sql
201        Enter password: <class password>
202
203The Plugin Architecture is now installed.
204
205Now go to Cacti in your web browser:
206
207        http://pcN.ws.nsrc.org/cacti
208
209Log in as the "admin" user.
210
211        Go to User Management
212        ==> select "admin" user
213        ==> at the bottom of the page check the box in the "Realm Permissions" that says
214            "Plugin Management"
215        ==> Press "Save"
216
217Note on the left side of the Cacti page there is now a "Plugin Management" option under
218Configuration.
219
220Now it's time to install a couple of Plugins and configure them.
221
222
2233. Install the Settings and thold Plugin
224----------------------------------------
225
226You can find a list of plugins here:
227
228        http://docs.cacti.net/plugins
229
230But, the most current version of several of the most popular plugins are available here:
231
232        http://cactiusers.org/
233
234The Settings plugin allows you to specify additional settings for sending email in Cacti.
235This is very important (actually critical) if you wish to set up Cacti so that it can
236send email and generate tickets in a ticketing system.
237
238To install the Settings plugin we do:
239
240        # cd /var/www/cacti/plugins
241        # wget http://cactiusers.org/downloads/settings.tar.gz
242
243if not available remotely or connection is too slow, then:
244
245        # wget http://noc.ws.nsrc.org/downloads/cacti/plugins/settings.tar.gz
246
247Next extract the file:
248
249        # tar xvzf settings.tar.gz
250
251Remove the tar.gz file:
252
253        # rm settings.tar.gz
254
255Next get the thold plugin:
256
257        # wget http://cactiusers.org/downloads/thold.tar.gz
258
259if not available remotely or connection is too slow, then:
260
261        # wget http://noc.ws.nsrc.org/downloads/cacti/plugins/thold.tar.gz
262
263Next extract the file:
264
265        # tar xvzf thold.tar.gz
266
267Remove the tar.gz file:
268
269        # rm thold.tar.gz
270
271Now we are ready to configure these two plugins to work with Cacti. The thold plugin will allow
272us to set thresholds that can cause triggers, such as sending an email message to a ticketing
273system and automatically generate a ticket when certain conditions are detected (CPU is too hot
274in the router, max bandwidth exceeded for 10 minutes, system load is to high on a server, etc...).
275
276
2774. Configure the Settings and thold plugins
278-------------------------------------------
279
280The steps to do this are done from with the Cacti web interface. As they are graphical please
281see the document:
282
283        cacti-plugin-configuration.pdf
284
285This document is linked in to the Agenda on the wiki for your class. Ask your instructor if you
286have questions.