Scroll to navigation

Munin::Master::Utils(3pm) User Contributed Perl Documentation Munin::Master::Utils(3pm)

NAME

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

SYNOPSIS

 use Munin::Master::Utils;

SUBROUTINES

Copy hash node.

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

Returns:
- Success: $to
- 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

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

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

  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.

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

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

COPYING

Copyright (C) 2010-2014 Steve Schnepp Copyright (C) 2003-2011 Jimmy Olsen Copyright (C) 2006-2010 Nicolai Langfeldt Copyright (C) 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.

2022-02-10 perl v5.34.0