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

# Munin::Node::OS(3pm)

OS related utility methods for the Munin node.

## NAME

Munin::Node::OS - OS related utility methods for the Munin node.

## SYNOPSIS

```
 use Munin::Node::OS;
 my $uid  = Munin::Node::OS->get_uid('foo');
 my $host = Munin::Node::OS->get_fq_hostname();
```

## METHODS

- **get\_uid**

  ```
   $uid = $class->get_uid($user)
  ```

  Returns the user ID. `$user` might either be a user name or a user ID. Returns undef if the user doesn't exist.

- **get\_gid**

  ```
   $gid = $class->get_gid($group)
  ```

  Returns the group ID. `$group` might either be a group name or a group ID. Returns undef if the group doesn't exist.

- **get\_fq\_hostname**

  ```
   $host = $class->get_fq_hostname()
  ```

  Returns the fully qualified host name of the machine.

- **check\_perms\_if\_paranoid**

  ```
   $bool = $class->check_perms_if_paranoid($target);
  ```

  If paranoia is enabled, returns false unless `$target` is owned by root, and has safe permissions.  If `$target` is a file, also checks the directory it inhabits.

- **run\_as\_child**

  ```
    $result = run_as_child($timeout, $coderef, @arguments);
  ```

  Creates a child process to run `$code` and waits for up to `$timeout` seconds for it to complete.  Returns a hashref containing the following keys:

  - "stdout", "stderr"

    Array references containing the output of these filehandles;

  - "retval"

    The result of **wait()**;

  - "timed\_out"

    True if the child had to be interrupted.

  System errors will cause it to carp.

- **reap\_child\_group**

  ```
   $class->reap_child_group($pid);
  ```

  Sends SIGHUP and SIGKILL to the process group identified by `$pid`.

  Sleeps for 2 seconds between SIGHUP and SIGKILL.

- **possible\_to\_signal\_process**

  ```
   my $bool = $class->possible_to_signal_process($pid)
  ```

  Check whether it's possible to send a signal to `$pid` (that means, to be brief, that the process is owned by the same user, or we are the super-user).  This is a useful way to check that a child process is alive (even if only as a zombie) and hasn't changed its UID.

- **set\_effective\_user\_id**

  ```
   eval {
       $class->set_effective_user_id($uid);
   };
   if ($@) {
       # Failed to set EUID
   }
  ```

  The name says it all ...

- **set\_effective\_group\_id**

  See documentation for **set\_effective\_user\_id()**

- **set\_real\_user\_id**

  See documentation for **set\_effective\_user\_id()**

- **set\_real\_group\_id**

  See documentation for **set\_effective\_user\_id()**

- **set\_umask**

  Set umask so that files created by plugins are group writable Only call right before exec-ing a plugin.
