-
Notifications
You must be signed in to change notification settings - Fork 7
/
slurm_prometheus_exporter.cf
104 lines (83 loc) · 3.25 KB
/
slurm_prometheus_exporter.cf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#
## slurm_prometheus_exporter @SURF
#
bundle common slurm_prometheus_exporter()
{
vars:
"exclude_list" slist => { ".svn", ".git" };
"service_name" string => "slurm_prometheus_exporter";
"daemon_name" string => "/opt/slurm_prometheus_exporter/slurm_prometheus_exporter";
"template_2_destination" data => parsejson('
{
"slurm_prometheus_exporter.default.mustache": "/etc/default/slurm_prometheus_exporter"
}
');
systemd::
"reload" string => "$(paths.path[systemctl]) reload $(service_name)";
"restart" string => "$(paths.path[systemctl]) restart $(service_name)";
!systemd::
"reload" string => "/etc/init.d/$(service_name) reload";
"restart" string => "/etc/init.d/$(service_name) restart";
}
bundle agent slurm_prometheus_exporter_install()
{
classes:
"copy_dirs_set" expression => isvariable("scl.slurm_prometheus_exporter[copy_dirs]");
methods:
copy_dirs_set::
"" usebundle => scl_service_copy_dirs("slurm_prometheus_exporter");
}
bundle agent slurm_prometheus_exporter_config()
{
services:
"$(slurm_prometheus_exporter.service_name)"
service_policy => "start";
methods:
any::
"" usebundle => scl_mustache_autorun("slurm_prometheus_exporter");
commands:
systemd::
"$(paths.path[systemctl]) daemon-reload"
if => or(
canonify("scl$(slurm_prometheus_exporter.systemd_file)")
);
!systemd::
"$(slurm_gpu_prometheus_exporter.restart)"
if => or(
canonify("scl$(slurm_prometheus_exporter.systemd_file)")
);
}
bundle agent slurm_prometheus_exporter_daemon_check()
{
processes:
"$(slurm_prometheus_exporter.daemon_name)"
comment => "Check if GPU Prometheus exporter is running",
process_count => check_range("$(slurm_prometheus_exporter.daemon_name)", "1", "1"),
process_select => scl_select_parent_process("1");
commands:
"$(slurm_prometheus_exporter.restart)"
if => canonify("$(slurm_prometheus_exporter.daemon_name)_out_of_range");
}
bundle agent slurm_prometheus_exporter_autorun()
{
meta:
"tags" slist => { "service_slurm_prometheus_exporter", "template_slurm_prometheus_exporter" };
methods:
"" usebundle => slurm_prometheus_exporter_install();
"" usebundle => slurm_prometheus_exporter_config();
"" usebundle => slurm_prometheus_exporter_daemon_check();
}
@if minimum_version(99.9)
# SLURM_PROMETHEUS_EXPORTER
**This bundle must be rewritten to the new standard**
Source: [slurm_prometheus_exporter.cf](/services/slurm_prometheus_exporter.cf)
This bundle will generate these/this file(s) from mustache templates:
* /etc/default/slurm_prometheus_exporter
If one of the files is changed then the following ""class"" will be set:
* scl_etc_default_slurm_prometheus_exporter
These templates are located in:
* templates/slurm_prometheus_exporter
* templates/slurm_prometheus_exporter/json
The following json variables can be set in def.cf/json to invoke files bundles:
* copy_dirs: See [files.cf](/masterfiles/lib/scl/files.cf)
@endif