/
Portfile
128 lines (89 loc) · 3.93 KB
/
Portfile
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
PortSystem 1.0
PortGroup golang 1.0
go.setup github.com/prometheus/node_exporter 1.7.0 v
github.tarball_from archive
revision 0
homepage https://prometheus.io/docs/guides/node-exporter
description Machine-metric exporter for the Prometheus monitoring \
system.
long_description The Prometheus Node Exporter can expose metrics that \
Prometheus can scrape, including a wide variety of \
system, hardware- and kernel-related metrics.
categories sysutils
installs_libs no
license Apache-2
maintainers {gmail.com:herby.gillot @herbygillot} \
openmaintainer
checksums rmd160 906671e73e7171d3543f20c5066f57ec7b6047df \
sha256 5da1dcc3608db663fc1949042c6f3ec29184c9414c37c0e2bdfe9b19fd5d75c7 \
size 328830
set svc_name prometheus-node-exporter
set prom_user prometheus
set ne_doc_dir ${prefix}/share/doc/${svc_name}
set ne_share_dir ${prefix}/share/${svc_name}
set ne_log_dir ${prefix}/var/log/${svc_name}
set ne_log_file ${ne_log_dir}/${name}.log
add_users ${prom_user} \
group=${prom_user} \
realname=Prometheus
depends_build-append \
port:promu
go.offline_build no
build.cmd make
build.target build
use_parallel_build no
# promu will fail if it cannot capture the current user using the USER
# environment variable. So if USER is not currently set in the environment,
# we'll set it here for purposes of the build.
if {! [info exists env(USER)]} {
build.env-append "USER=${macportsuser}"
}
pre-build {
# Link promu into where the Makefile expects to find it so that it doesn't
# try to fetch and install promu again on its own.
file mkdir ${gopath}/bin
ln -s ${prefix}/bin/promu ${gopath}/bin/
}
post-extract {
copy ${filespath}/org.macports.${name}.plist \
${workpath}/org.macports.${name}.plist
reinplace "s|@NAME@|${name}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@USER@|${prom_user}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@GROUP@|${prom_user}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@PREFIX@|${prefix}|g" \
${workpath}/org.macports.${name}.plist
reinplace "s|@LOGFILE@|${ne_log_file}|g" \
${workpath}/org.macports.${name}.plist
}
destroot {
xinstall -m 0755 ${worksrcpath}/${name} ${destroot}${prefix}/bin/${name}
xinstall -d -m 0755 ${destroot}${ne_doc_dir}
xinstall -d -m 0755 ${destroot}${ne_share_dir}
xinstall -d -m 0755 -o ${prom_user} -g ${prom_user} ${destroot}${ne_log_dir}
touch ${destroot}${ne_log_file}
file attributes ${destroot}${ne_log_file} \
-owner ${prom_user} -group ${prom_user}
foreach _dir {examples text_collector_examples} {
copy ${worksrcpath}/${_dir} ${destroot}${ne_share_dir}/
}
copy {*}[glob ${worksrcpath}/docs/*] ${destroot}${ne_doc_dir}/
xinstall -d -m 0755 \
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}
xinstall -m 0644 -o root -W ${workpath} org.macports.${name}.plist \
${destroot}${prefix}/etc/LaunchDaemons/org.macports.${name}
xinstall -d -m 0755 ${destroot}/Library/LaunchDaemons
ln -s ${prefix}/etc/LaunchDaemons/org.macports.${name}/org.macports.${name}.plist \
${destroot}/Library/LaunchDaemons/org.macports.${name}.plist
}
github.livecheck.regex {([0-9.]+)}
notes "
To enable the Prometheus Node Exporter service, use `port load`, as follows:
\$ sudo port load ${name}
When enabled, by default, the service will be available at http://localhost:9100
...and by default will also log to:
${ne_log_file}
"