1Munin::Master::Utils(3)User Contributed Perl DocumentatioMnunin::Master::Utils(3)
2
3
4
6 Munin::Master::Utils - Exports a lot of utility functions.
7
9 use Munin::Master::Utils;
10
12 munin_category_status
13 Gets current status of a category.
14
15 Parameters:
16 - $hash: A ref to the hash node whose children to check
17 - $limits: A ref to the root node of the limits tree
18 - $category: The category to review
19 - $check_draw: [optional] Ignore undrawn fields
20
21 Returns:
22 - Success: The status of the field
23 - Failure: undef
24
25 munin_config
26 munin_copy_node
27 Copy hash node.
28
29 Parameters:
30 - $from: Hash node to copy
31 - $to: Where to copy it to
32
33 Returns:
34 - Success: $to
35 - Failure: undef
36
37 munin_copy_node_toloc
38 Copy hash node at.
39
40 Parameters:
41 - $from: Hash node to copy
42 - $to: Where to copy it to
43 - $loc: Path to node under $to
44
45 Returns:
46 - Success: $to
47 - Failure: undef
48
49 munin_createlock
50 munin_delete
51 munin_draw_field
52 Check whether a field will be visible in the graph or not.
53
54 Parameters:
55 - $hash: A ref to the hash node for the field
56
57 Returns:
58 - Success: Boolean; true if field will be graphed, false if not
59 - Failure: undef
60
61 munin_fetch
62 munin_field_status
63 Gets current status of a field.
64
65 Parameters:
66 - $hash: A ref to the field hash node
67 - $limits: A ref to the root node of the limits tree
68 - $check_draw: [optional] Ignore undrawn fields
69
70 Returns:
71 - Success: The status of the field
72 - Failure: undef
73
74 munin_find_field
75 Search a hash to find hash nodes with $field defined.
76
77 Parameters:
78 - $hash: A hash ref to search
79 - $field: The name of the field to search for, or a regex
80 - $avoid: [optional] Stop traversing further down if this field is
81 found
82
83 Returns:
84 - Success: A ref to an array of the hash nodes containing $field.
85 - Failure: undef
86
87 munin_get
88 Get variable.
89
90 Parameters:
91 - $hash: Ref to hash node
92 - $field: Name of field to get
93 - $default: [optional] Value to return if $field isn't set
94
95 Returns:
96 - Success: field contents
97 - Failure: $default if defined, else undef
98
99 munin_get_bool
100 Get boolean variable.
101
102 Parameters:
103 - $hash: Ref to hash node
104 - $field: Name of field to get
105 - $default: [optional] Value to return if $field isn't set
106
107 Returns:
108 - Success: 1 or 0 (true or false)
109 - Failure: $default if defined, else undef
110
111 munin_get_bool_val
112 munin_get_children
113 Get all child hash nodes.
114
115 Parameters:
116 - $hash: A hash ref to the parent node
117
118 Returns:
119 - Success: A ref to an array of the child nodes
120 - Failure: undef
121
122 munin_get_field_order
123 Get the field order in a graph.
124
125 Parameters:
126 - $hash: A hash ref to the service
127
128 Returns:
129 - Success: A ref to an array of the field names
130 - Failure: undef
131
132 munin_get_filename
133 Get rrd filename for a field, without any bells or whistles. Used
134 by munin-update to figure out which file to update.
135
136 Parameters:
137 - $hash: Ref to hash field
138
139 Returns:
140 - Success: Full path to rrd file
141 - Failure: undef
142
143 munin_get_html_filename
144 Get the full path-name of an html file.
145
146 Parameters:
147 - $hash: A ref to the service hash node
148
149 Returns:
150 - Success: The file name with full path
151 - Failure: undef
152
153 munin_get_max_label_length
154 Get the length of the longest labe in a graph.
155
156 Parameters:
157 - $hash: the graph in question
158 - $order: A ref to an array of fields (graph_order)
159
160 Returns:
161 - Success: The length of the longest label in the graph
162 - Failure: undef
163
164 munin_get_node
165 Gets a node by loc.
166
167 Parameters:
168 - $hash: A ref to the hash to set the variable in
169 - $loc: A ref to an array with the full path of the node
170
171 Returns:
172 - Success: The node ref found by $loc
173 - Failure: undef
174
175 munin_get_node_loc
176 Get location array for hash node.
177
178 Parameters:
179 - $hash: A ref to the node
180
181 Returns:
182 - Success: Ref to an array with the full path of the variable
183 - Failure: undef
184
185 munin_get_node_name
186 Return the name of the hash node supplied.
187
188 Parameters:
189 - $hash: A ref to the hash node
190
191 Returns:
192 - Success: The name of the node
193
194 munin_get_node_partialpath
195 Gets a node from a partial path.
196
197 Parameters:
198 - $hash: A ref to the "current" location in the hash tree
199 - $var: A path string with relative location (from the $hash).
200
201 Returns:
202 - Success: The node
203 - Failure: undef
204
205 munin_get_parent
206 Get parent node of a hash.
207
208 Parameters:
209 - $hash: A ref to the node
210
211 Returns:
212 - Success: Ref to an parent
213 - Failure: undef
214
215 munin_get_parent_name
216 Return the name of the parent of the hash node supplied
217
218 Parameters:
219 - $hash: A ref to the hash node
220
221 Returns:
222 - Success: The name of the parent node
223 - Failure: If no parent node exists, "none" is returned.
224
225 munin_get_picture_filename
226 Get the full path+name of a picture file.
227
228 Parameters:
229 - $hash: A ref to the service hash node
230 - $scale: [optional] The scale (day, week, year, month)
231 - $sum: [optional] Boolean value, whether it's a sum graph or not.
232
233 Returns:
234 - Success: The file name with full path
235 - Failure: undef
236
237 munin_get_picture_loc
238 Get location array for hash node for picture purposes. Differs from
239 munin_get_node_loc in that it honors #%#origin metadata
240
241 Parameters:
242 - $hash: A ref to the node
243
244 Returns:
245 - Success: Ref to an array with the full path of the variable
246 - Failure: undef
247
248 munin_get_root_node
249 Get the root node of the hash tree.
250
251 Parameters:
252 - $hash: A hash node to traverse up from
253
254 Returns:
255 - Success: A ref to the root hash node
256 - Failure: undef
257
258 munin_get_rrd_filename
259 Get the name of the rrd file corresponding to a field. Checks for
260 lots of bells and whistles. This function is the correct one to
261 use when figuring out where to fetch data from.
262
263 Parameters:
264 - $field: The hash object of the field
265 - $path: [optional] The path to the field (as given in
266 graph_order/sum/stack/et al)
267
268 Returns:
269 - Success: A string with the filename of the rrd file
270 - Failure: undef
271
272 munin_get_separated_node
273 Copy a node to a separate node without "specials".
274
275 Parameters:
276 - $hash: The node to copy
277
278 Returns:
279 - Success: A ref to a new node without "#%#"-fields
280 - Failure: undef
281
282 munin_get_var_path
283 munin_getlock
284 munin_graph_column_headers
285 munin_has_subservices
286 munin_has_subservices($hash);
287
288 Checks whether the service represented by $hash has subservices
289 (multigraph), and returns the result.
290
291 Parameters:
292 - $hash: Hash reference pointing to a service
293
294 Returns:
295 - true: if the hash is indeed a service, and said service has got
296 subservices
297 - false: otherwise
298
299 munin_mkdir_p
300 munin_mkdir_p('/a/path/', oct('777'));
301
302 Make a directory and recursivly any nonexistent directory in the
303 path to it.
304
305 munin_node_status
306 munin_nscasend
307 munin_overwrite
308 Take contents of one config-namespace and replace/insert the
309 instances needed.
310
311 munin_parse_config
312 munin_path_to_loc
313 Returns a loc array from a path string.
314
315 Parameters:
316 - $path: A path string
317
318 Returns:
319 - Success: A ref to an array with the loc
320 - Failure: undef
321
322 munin_readconfig
323 munin_removelock
324 munin_runlock
325 munin_service_status
326 Gets current status of a service.
327
328 Parameters:
329 - $hash: A ref to the field hash node
330 - $limits: A ref to the root node of the limits tree
331 - $check_draw: [optional] Ignore undrawn fields
332
333 Returns:
334 - Success: The status of the field
335 - Failure: undef
336
337 munin_set
338 Sets a variable in a hash.
339
340 Parameters:
341 - $hash: A ref to the hash to set the variable in
342 - $var: The name of the variable
343 - $val: The value to set the variable to
344
345 Returns:
346 - Success: The $hash we were handed
347 - Failure: undef
348
349 munin_set_var_loc
350 Sets a variable in a hash.
351
352 Parameters:
353 - $hash: A ref to the hash to set the variable in
354 - $loc: A ref to an array with the full path of the variable
355 - $val: The value to set the variable to
356
357 Returns:
358 - Success: The $hash we were handed
359 - Failure: undef
360
361 munin_set_var_path
362 Sets a variable in a hash.
363
364 Parameters:
365 - $hash: A ref to the hash to set the variable in
366 - $var: A string with the full path of the variable
367 - $val: The value to set the variable to
368
369 Returns:
370 - Success: The $hash we were handed
371 - Failure: The $hash we were handed
372
373 munin_trend
374 munin_writeconfig
375 munin_writeconfig_loop
376
378 Copyright (C) 2003-2007 Jimmy Olsen, Audun Ytterdal
379
380 This program is free software; you can redistribute it and/or modify it
381 under the terms of the GNU General Public License as published by the
382 Free Software Foundation; version 2 dated June, 1991.
383
384 This program is distributed in the hope that it will be useful, but
385 WITHOUT ANY WARRANTY; without even the implied warranty of
386 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
387 General Public License for more details.
388
389 You should have received a copy of the GNU General Public License along
390 with this program; if not, write to the Free Software Foundation, Inc.,
391 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
392
393
394
395perl v5.12.2 2010-12-05 Munin::Master::Utils(3)