1Munin::Node::Service(3pUms)er Contributed Perl DocumentatMiuonnin::Node::Service(3pm)
2
3
4
6 Munin::Node::Service - Methods related to handling of Munin services
7
9 my $services = Munin::Node::Service->new(timeout => 30);
10 $services->prepare_plugin_environment;
11 if ($services->is_a_runnable_service($file_name)) {
12 $services->fork_service($file_name);
13 }
14
16 new
17 my $services = Munin::Node::Service->new(%args);
18
19 Constructor. All arguments are optional. Valid arguments are:
20
21 "servicedir"
22 The directory that will be searched for services.
23
24 "defuser", "defgroup"
25 The default uid and gid that services will run as.
26 Service-specific user and group directives (as set by the
27 service configuration files) will override this.
28
29 "timeout"
30 The default timeout for services. Services taking longer
31 than this to run will be killed. Service-specific timeouts
32 will (as set in the service configuration files) will
33 override this value.
34
35 is_a_runnable_service
36 my $bool = $services->is_a_runnable_service($file_name);
37
38 Runs miscellaneous tests on $file_name in the service directory, to
39 try and establish whether it is a runnable service.
40
41 list
42 my @services = $services->list;
43
44 Returns a list of all the runnable services in the directory.
45
46 prepare_plugin_environment
47 $services->prepare_plugin_environment(@services);
48
49 Carries out various tasks that plugins require before being run,
50 such as loading service configurations and exporting common
51 environment variables.
52
53 export_service_environment
54 $services->export_service_enviromnent($service);
55
56 Exports all the environment variables specific to service $service.
57
58 change_real_and_effective_user_and_group
59 $service->change_real_and_effective_user_and_group($service);
60
61 Changes the current process' effective group and user IDs to those
62 specified in the configuration, or the default user or group
63 otherwise. Also changes the real group and user IDs if the
64 operating system supports it.
65
66 On failure, causes the process to exit.
67
68 exec_service
69 $service->exec_service($service, [@arguments]);
70
71 Replaces the current process with an instance of service $service
72 in $directory, running with the correct environment and privileges.
73
74 This function never returns. The process will exit(2) if the
75 service to be run failed the paranoia check.
76
77 fork_service
78 $result = $service->fork_service($service, [$argument]);
79
80 Identical to exec_service(), except it runs the service in a
81 subprocess. If the service takes longer than the timeout, it will
82 be terminated.
83
84 Returns a hash reference containing (among other things) the
85 service's output and exit value. (See documentation for
86 run_as_child() in Munin::Node::Service for a comprehensive
87 description.)
88
89
90
91perl v5.38.0 2023-11-06 Munin::Node::Service(3pm)