Munin::Master::Utils

Section: User Contributed Perl Documentation (3)
Updated: 2020-01-21
Page Index
 

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.


 

Index

NAME
SYNOPSIS
SUBROUTINES
COPYING
LinuxReviews : manual page archive : man3pm