1Munin::Node::OS(3)    User Contributed Perl Documentation   Munin::Node::OS(3)
2
3
4

NAME

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

SYNOPSIS

9        use Munin::Node::OS;
10        my $uid  = Munin::Node::OS->get_uid('foo');
11        my $host = Munin::Node::OS->get_fq_hostname();
12

METHODS

14       get_uid
15            $uid = $class->get_uid($user)
16
17           Returns the user ID. $user might either be a user name or a user
18           ID. Returns undef if the user doesn't exist.
19
20       get_gid
21            $gid = $class->get_gid($group)
22
23           Returns the group ID. $group might either be a group name or a
24           group ID. Returns undef if the group doesn't exist.
25
26       get_fq_hostname
27            $host = $class->get_fq_hostname()
28
29           Returns the fully qualified host name of the machine.
30
31       check_perms_if_paranoid
32            $bool = $class->check_perms_if_paranoid($target);
33
34           If paranoia is enabled, returns false unless $target is owned by
35           root, and has safe permissions.  If $target is a file, also checks
36           the directory it inhabits.
37
38       run_as_child
39             $result = run_as_child($timeout, $coderef, @arguments);
40
41           Creates a child process to run $code and waits for up to $timeout
42           seconds for it to complete.  Returns a hashref containing the
43           following keys:
44
45           "stdout", "stderr"
46               Array references containing the output of these filehandles;
47
48           "retval"
49               The result of wait();
50
51           "timed_out"
52               True if the child had to be interrupted.
53
54           System errors will cause it to carp.
55
56       reap_child_group
57            $class->reap_child_group($pid);
58
59           Sends SIGHUP and SIGKILL to the process group identified by $pid.
60
61           Sleeps for 2 seconds between SIGHUP and SIGKILL.
62
63       possible_to_signal_process
64            my $bool = $class->possible_to_signal_process($pid)
65
66           Check whether it's possible to send a signal to $pid (that means,
67           to be brief, that the process is owned by the same user, or we are
68           the super-user).  This is a useful way to check that a child
69           process is alive (even if only as a zombie) and hasn't changed its
70           UID.
71
72       set_effective_user_id
73            eval {
74                $class->set_effective_user_id($uid);
75            };
76            if ($@) {
77                # Failed to set EUID
78            }
79
80           The name says it all ...
81
82       set_effective_group_id
83           See documentation for set_effective_user_id()
84
85       set_real_user_id
86           See documentation for set_effective_user_id()
87
88       set_real_group_id
89           See documentation for set_effective_user_id()
90
91       set_umask
92           Set umask so that files created by plugins are group writable Only
93           call right before exec-ing a plugin.
94
95
96
97perl v5.32.1                      2021-02-05                Munin::Node::OS(3)
Impressum