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