27 |
28 |
35 |
36 |
37 |
38 |
Installation
39 |
40 |
Cacti plugin and Editor
41 |
42 |
Requirements
43 |
44 |
Before doing anything else, please verify that your
45 | Plugin Architecture is working
46 | properly with a simpler plugin, like
47 | Links or
48 | Tools. Weathermap is relatively
49 | complex, and fault-finding both your Cacti Plugin Architecture and
50 | Weathermap at the same time will make life harder for you!
51 |
52 |
You will need the 'pcre' and 'gd' PHP modules in
53 | both your command-line and server-side (mod_php/ISAPI) PHP. The
54 | poller-process runs using the command-line PHP, and the editor uses the
55 | server-side one. In some situations it is possible to have two completely
56 | different PHP installations serving these two
57 | - if you install from a package, then re-install from source, but to a
58 | different directory, for example. The editor and the poller process should
59 | both warn you if the part they need is not present.
60 |
61 |
You can then use the pre-install checker to see if your PHP environment
62 | has everything it needs. To do this, you need to run a special
63 | check.php script, twice...
64 |
65 |
First, go to http://yourcactiserver/plugins/weathermap/check.php to see
66 | if your webserver PHP (mod_php, ISAPI etc) is OK. Then, from a
67 | command-prompt run
68 | php check.php to see if your command-line PHP is OK. If any modules
69 | or functions are missing, you will get a warning, and an explanation of what
70 | will be affected (not all of the things that are checked are deadly
71 | problems).
72 |
73 |
Before you start using it, you might want to change one PHP setting.
74 | Weathermap uses a fair bit of memory by PHP standards, as it builds the
75 | image for the map in memory before saving it. As a result, your PHP process
76 | may run out of memory. PHP has a 'safety valve' built-in, to stop
77 | runaway scripts from killing your server, which defaults to 8MB in most
78 | versions (this has changed in 5.2.x). This is controlled by the
79 | 'memory_limit =' line in php.ini. You may need to increase this to 32MB or
80 | even more if you have problems. In fact, the current Cacti manual suggests
81 | 128MB. These problems will typically show up as the poller process just
82 | dying with no warning or error message, as PHP kills the script.
83 |
84 |
Installation
85 |
86 |
To use the Cacti plugin, you
87 | must unpack the zip file into a directory called
88 | '<cacti_root>/plugins/weathermap'. The zip contains a folder
89 | called 'weathermap' already, so unzipping it in the plugins folder should do
90 | the job.
91 |
92 |
File Permissions
93 |
94 |
95 | You will need to change the permissions on the
96 | output directory, so that the Cacti poller process can write to it.
97 | This is the same as you would have done for the
98 | rra directory while installing Cacti itself originally. For a *nix
99 | system, it will be something like:
100 |
101 |
102 |
103 | chown cactiuser output
104 |
105 |
106 |
107 |
Getting Started
108 |
109 |
To actually enable the plugin, you need to add a line to your Cacti
110 | config file. This file is includes/config.php for Cacti 0.8.6 and
111 | includes/global.php for Cacti 0.8.7(a through f), then includes/config.php again for 0.8.7g and newer:
112 |
113 |
114 |
115 |
116 | $plugins = array();
117 | $plugins[] = 'monitor';
118 | $plugins[] = 'weathermap';
119 |
120 |
121 |
122 |
123 | Now, refresh your Cacti page, to be sure that everything is still working
124 | right. If not, remove the line you just added and you should return to
125 | normal. Make a note of any error message and let me know!
126 |
127 |
128 |
129 |
Assuming it all looks fine (but not
130 | very different), you can start to enable Weathermap. Log in as 'admin' or
131 | another user with User Management rights, go to the User Management section
132 | under Tools in the Cacti console, and then choose your own username from the
133 | list. Check the two new 'realms' boxes that should be there
134 | - View Weathermaps, and Manage Weathermaps
135 | - and then click Save. A 'Weathermap' tab should appear at the top of the
136 | page.
137 |
138 |
That's it! The Weathermap plugin is installed. To go further, you need
139 | some weathermap configuration files to define your maps. You can do this in
140 | two ways
141 | - using the Web-based map editor, or by editing the text-based configuration
142 | files directly.
143 |
144 |
To use the editor, you need to make a few more changes (see below).
145 |
146 |
To learn more about actually using the Cacti plugin, see the
147 | Cacti Plugin page.
148 |
149 |
The Editor
150 |
151 |
Once you have weathermap itself working, continue onto the editor:
152 |
153 |
154 | Copy the editor-config.php-dist file to
155 | editor-config.php. If you want to be able to pick data sources from
156 | your Cacti installation by name, edit the file and make sure that the line
157 | that sets
158 | $cacti_base is correct, and that the base URI below that is also
159 | correct for your Cacti installation (these two lines are marked CHANGE in
160 | the file).
161 |
162 |
163 |
164 | Make sure that your webserver can write to the configs directory. To do
165 | this, you need to know which user your webserver runs as (maybe 'nobody',
166 | 'www' or 'httpd' on most *nixes) and then run:
167 |
168 |
169 |
chown www configs
170 | chmod u+w configs
171 |
172 |
173 | In a pinch, you can just
chmod 777 configs, but this
174 |
really isn't a recommended solution for a production system.
175 |
176 |
On Windows, the same applies
177 | - the user that runs the webserver runs as should have permissions to write
178 | new files, and change existing files in the configs folder.
179 |
180 |
181 |
Since version 0.97, you now also need to enable the editor. The reason is
182 | so that you can't have the editor enabled without knowing about it. The
183 | editor allows access to your config files without authentication (it doesn't
184 | use Cacti's authentication), so you should consider using features in your
185 | webserver to limit who can access
186 | editor.php. For example, on an Apache server, something like:
187 |
188 |
189 | <Directory /var/www/html/cacti/plugins/weathermap>
190 | <Files editor.php>
191 | Order Deny,Allow
192 | Deny from all
193 | Allow from 127.0.0.1
194 | </FilesMatch>
195 | </Directory>
196 |
197 | When you are happy that the world can't edit your maps, then enable the
198 | editor. This is done by editing the top of editor.php and changing
199 |
$ENABLED=false; to
$ENABLED=true;
200 |
201 |
202 | You should now be able to go to
203 | http://your.server/cacti/plugins/weathermap/editor.php in a browser, and get
204 | a welcome page that offers to load or create a config file. That's it. All
205 | done. Please see the
206 | editor manual page for more about
207 | using the editor!
208 |
209 |
210 |
You can also edit an existing map from the Cacti web interface, by
211 | choosing Manage..Weathermaps and then clicking on the name of a config file
212 | in the list of active maps. The editor will open with that map loaded.
213 |
214 |
215 | Important Security Note: The editor allows
216 | anyone who can access editor.php to change the configuration files
217 | for your network weathermaps. There is no authentication built-in for
218 | editing, even with the Cacti Plugin. This is why the configuration file
219 | doesn't exist by default
220 | - the editor won't work until you choose to make it work. It's recommended
221 | that you either:
222 |
223 |
- change the ownership of configuration files so that the editor can't
224 | write to them once they are complete, or
- use your webserver's
225 | authentication and access control facilities to limit who can access the
226 | editor.php URL. On apache, this can be done using the FilesMatch directive
227 | and mod_access.
228 |
229 |
230 |
231 |