---
name: "Munin::Master::Utils"
section: "3pm"
platform: "linux"
package: "munin"
version: "2.0.76-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/Munin::Master::Utils"
---

# Munin::Master::Utils(3pm)

Exports a lot of utility functions.

## NAME

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

## SYNOPSIS

```
 use Munin::Master::Utils;
```

## SUBROUTINES

- **munin\_category\_status**

  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

- **munin\_readconfig\_base**

  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)

- **munin\_copy\_node**

  Copy hash node.

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

  Returns:\
    \- Success: `$to`\
    \- Failure: undef

- **munin\_copy\_node\_toloc**

  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

- **munin\_createlock**

  - **munin\_delete**

  - **munin\_draw\_field**

  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

- **munin\_field\_status**

  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

- **munin\_find\_field**

  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

- **munin\_get**

  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

- **munin\_get\_bool**

  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

- **munin\_get\_bool\_val**

  - **munin\_get\_children**

  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

- **munin\_get\_field\_order**

  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

- **munin\_get\_filename**

  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

- **munin\_get\_html\_filename**

  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

- **munin\_get\_max\_label\_length**

  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

- **munin\_get\_node**

  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

- **munin\_get\_node\_loc**

  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

- **munin\_get\_node\_name**

  Return the name of the hash node supplied.

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

  Returns:\
    \- Success: The name of the node

- **munin\_get\_node\_partialpath**

  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

- **munin\_get\_parent**

  Get parent node of a hash.

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

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

- **munin\_get\_parent\_name**

  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.

- **munin\_get\_picture\_filename**

  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

- **munin\_get\_picture\_loc**

  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

- **munin\_get\_root\_node**

  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

- **munin\_get\_rrd\_filename**

  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

- **munin\_get\_separated\_node**

  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\_get\_var\_path**

  - **munin\_getlock**

  - **munin\_graph\_column\_headers**

  - **munin\_has\_subservices**

  ```
    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**

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

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

- **munin\_node\_status**

  - **munin\_nscasend**

  - **munin\_overwrite**

  Take contents of one config-namespace and replace/insert the instances needed.

- **munin\_parse\_config**

  - **munin\_path\_to\_loc**

  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

- **munin\_readconfig\_part**

  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`

- **munin\_removelock**

  - **munin\_runlock**

  - **munin\_service\_status**

  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

- **munin\_set**

  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

- **munin\_set\_var\_loc**

  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

- **munin\_set\_var\_path**

  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

- **munin\_writeconfig**

  - **munin\_writeconfig\_loop**

  ## COPYING

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.
