DOKK / manpages / debian 12 / munin-doc / Munin::Master::Utils.3pm.en
Munin::Master::Utils(3pm) User Contributed Perl Documentation Munin::Master::Utils(3pm)

Munin::Master::Utils - Exports a lot of utility functions.

 use Munin::Master::Utils;

Gets current status of a category.

Parameters:
- $hash: A ref to the hash node whose children to check
- $limits: A ref to the root node of the limits tree
- $category: The category to review
- $check_draw: [optional] Ignore undrawn fields

Returns:
- Success: The status of the field
- Failure: undef

Read configuration file, include dir files, and initialize important default values that are optional.

Parameters:
- $file: munin.conf filename. If omitted, default filename is used.

Returns:
- Success: The $config hash (also cached in module)

Copy hash node.

Parameters:
- $from: Hash node to copy
- $to: Where to copy it to

Returns:
- Success: $to
- Failure: undef

Copy hash node at.

Parameters:
- $from: Hash node to copy
- $to: Where to copy it to
- $loc: Path to node under $to

Returns:
- Success: $to
- Failure: undef

Check whether a field will be visible in the graph or not.

Parameters:
- $hash: A ref to the hash node for the field

Returns:
- Success: Boolean; true if field will be graphed, false if not
- Failure: undef

Gets current status of a field.

Parameters:
- $hash: A ref to the field hash node
- $limits: A ref to the root node of the limits tree
- $check_draw: [optional] Ignore undrawn fields

Returns:
- Success: The status of the field
- Failure: undef

Search a hash to find hash nodes with $field defined.

Parameters:
- $hash: A hash ref to search
- $field: The name of the field to search for, or a regex
- $avoid: [optional] Stop traversing further down if this field is found

Returns:
- Success: A ref to an array of the hash nodes containing $field.
- Failure: undef

Get variable.

Parameters:
- $hash: Ref to hash node
- $field: Name of field to get
- $default: [optional] Value to return if $field isn't set

Returns:
- Success: field contents
- Failure: $default if defined, else undef

Get boolean variable.

Parameters:
- $hash: Ref to hash node
- $field: Name of field to get
- $default: [optional] Value to return if $field isn't set

Returns:
- Success: 1 or 0 (true or false)
- Failure: $default if defined, else undef

Get all child hash nodes.

Parameters:
- $hash: A hash ref to the parent node

Returns:
- Success: A ref to an array of the child nodes
- Failure: undef

Get the field order in a graph.

Parameters:
- $hash: A hash ref to the service

Returns:
- Success: A ref to an array of the field names
- Failure: undef

Get rrd filename for a field, without any bells or whistles. Used by munin-update to figure out which file to update.

Parameters:
- $hash: Ref to hash field

Returns:
- Success: Full path to rrd file
- Failure: undef

Get the full path-name of an html file.

Parameters:
- $hash: A ref to the service hash node

Returns:
- Success: The file name with full path
- Failure: undef

Get the length of the longest label in a graph.

Parameters:
- $hash: the graph in question
- $order: A ref to an array of fields (graph_order)

Returns:
- Success: The length of the longest label in the graph
- Failure: undef

Gets a node by loc.

Parameters:
- $hash: A ref to the hash to set the variable in
- $loc: A ref to an array with the full path of the node

Returns:
- Success: The node ref found by $loc
- Failure: undef

Get location array for hash node.

Parameters:
- $hash: A ref to the node

Returns:
- Success: Ref to an array with the full path of the variable
- Failure: undef

Return the name of the hash node supplied.

Parameters:
- $hash: A ref to the hash node

Returns:
- Success: The name of the node

Gets a node from a partial path.

Parameters:
- $hash: A ref to the "current" location in the hash tree
- $var: A path string with relative location (from the $hash).

Returns:
- Success: The node
- Failure: undef

Get parent node of a hash.

Parameters:
- $hash: A ref to the node

Returns:
- Success: Ref to an parent
- Failure: undef

Return the name of the parent of the hash node supplied

Parameters:
- $hash: A ref to the hash node

Returns:
- Success: The name of the parent node
- Failure: If no parent node exists, "none" is returned.

Get the full path+name of a picture file.

Parameters:
- $hash: A ref to the service hash node
- $scale: [optional] The scale (day, week, year, month)
- $sum: [optional] Boolean value, whether it's a sum graph or not.

Returns:
- Success: The file name with full path
- Failure: undef

Get location array for hash node for picture purposes. Differs from munin_get_node_loc in that it honors #%#origin metadata

Parameters:
- $hash: A ref to the node

Returns:
- Success: Ref to an array with the full path of the variable
- Failure: undef

Get the root node of the hash tree.

Parameters:
- $hash: A hash node to traverse up from

Returns:
- Success: A ref to the root hash node
- Failure: undef

Get the name of the rrd file corresponding to a field. Checks for lots of bells and whistles. This function is the correct one to use when figuring out where to fetch data from.

Parameters:
- $field: The hash object of the field
- $path: [optional] The path to the field (as given in graph_order/sum/stack/et al)

Returns:
- Success: A string with the filename of the rrd file
- Failure: undef

Copy a node to a separate node without "specials".

Parameters:
- $hash: The node to copy

Returns:
- Success: A ref to a new node without "#%#"-fields
- Failure: undef

  munin_has_subservices($hash);
    

Checks whether the service represented by $hash has subservices (multigraph), and returns the result.

Parameters:
- $hash: Hash reference pointing to a service

Returns:
- true: if the hash is indeed a service, and said service has got subservices
- false: otherwise

 munin_mkdir_p('/a/path/', oct('777'));
    

Make a directory and recursively any nonexistent directory in the path to it.

Take contents of one config-namespace and replace/insert the instances needed.
Returns a loc array from a path string.

Parameters:
- $path: A path string

Returns:
- Success: A ref to an array with the loc
- Failure: undef

Read a partial configuration

Parameters:
- $what: name of the part that should be loaded (datafile or limits)

Returns:
- Success: a $config with the $specified part, but overwritten by $config

Gets current status of a service.

Parameters:
- $hash: A ref to the field hash node
- $limits: A ref to the root node of the limits tree
- $check_draw: [optional] Ignore undrawn fields

Returns:
- Success: The status of the field
- Failure: undef

Sets a variable in a hash.

Parameters:
- $hash: A ref to the hash to set the variable in
- $var: The name of the variable
- $val: The value to set the variable to

Returns:
- Success: The $hash we were handed
- Failure: undef

Sets a variable in a hash.

Parameters:
- $hash: A ref to the hash to set the variable in
- $loc: A ref to an array with the full path of the variable
- $val: The value to set the variable to

Returns:
- Success: The $hash we were handed
- Failure: undef

Sets a variable in a hash.

Parameters:
- $hash: A ref to the hash to set the variable in
- $var: A string with the full path of the variable
- $val: The value to set the variable to

Returns:
- Success: The $hash we were handed
- Failure: The $hash we were handed

Copyright (C) 2003-2007 Jimmy Olsen, Audun Ytterdal

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 dated June, 1991.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

2023-03-21 perl v5.36.0