blob: a744ad37593a3c0b5d3facc4ff1a2b17b5e1ad63 (
plain)
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
|
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
EAPI=6
inherit systemd
DESCRIPTION="Linode's Longview Agent"
HOMEPAGE="https://github.com/linode/longview"
SRC_URI="https://github.com/linode/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64"
IUSE="apache2 mysql nginx"
RDEPEND="
app-portage/eix
dev-lang/perl
dev-perl/Crypt-SSLeay
dev-perl/DBI
dev-perl/IO-Socket-INET6
dev-perl/JSON
dev-perl/Linux-Distribution
dev-perl/Log-LogLite
dev-perl/perl-headers
dev-perl/Try-Tiny
apache2? ( www-servers/apache[apache2_modules_status] )
mysql? ( dev-perl/DBD-mysql )
"
src_prepare() {
sed 's|/var/run|/run|' \
-i Linode/Longview/Util.pm \
-i Extras/init/longview.service \
|| die "sed failed"
eapply_user
}
src_configure() {
:
}
src_compile() {
:
}
src_install() {
default
insinto /opt/linode/${PN}
doins -r Linode
fperms 0755 /opt/linode/longview/Linode/Longview.pl
insinto /opt/linode/${PN}/Linode/Longview/DataGetter/Packages/
doins Extras/Modules/Packages/Gentoo.pm
keepdir /var/log/linode/
insinto /etc/linode/longview.d/
keepdir /etc/linode/longview.d/
use apache2 && doins Extras/conf/Apache.conf
use mysql && doins Extras/conf/MySQL.conf
use nginx && doins Extras/conf/Nginx.conf
doinitd "${FILESDIR}"/${PN}
systemd_dounit Extras/init/longview.service
}
pkg_postinst() {
local api_key
local api_key_path=/etc/linode/longview.key
[[ -f ${api_key_path} ]] && api_key=$(<${api_key_path})
if [[ -z $api_key ]] ; then
elog "Before you start Longview, you need to get the API key for this host."
elog "Go to:"
elog " https://manager.linode.com/longview/"
elog "Click on the 'i' button of the client matching this host (or create a"
elog "new one), and save the Longview API Key to:"
elog " ${api_key_path}"
elog
fi
if [[ -z ${REPLACING_VERSIONS} ]] ; then
if use apache2 ; then
elog "You'll need to configure Apache as detailed in the following link:"
elog "https://www.linode.com/docs/platform/longview/longview-app-for-apache#manual-configuration-all-distributions"
elog
fi
elog "You'll need to open the firewall a bit so Longview client can talk with"
elog "the monitoring server:"
elog
elog " # iptables -I INPUT -s longview.linode.com -j ACCEPT"
elog " # iptables -I OUTPUT -d longview.linode.com -j ACCEPT"
elog " # ip6tables -I INPUT -s longview.linode.com -j ACCEPT"
elog " # ip6tables -I OUTPUT -d longview.linode.com -j ACCEPT"
elog
elog " # rc-service iptables save"
elog " # rc-service ip6tables save"
elog
elog "Once you've done the above, you can start it:"
elog " # rc-service longview start"
elog " # rc-update add longview"
fi
}
|