Grafana

Request a package to be made here. Make sure you have searched before requesting.

Grafana

Postby Barto » Sat Mar 09, 2019 11:26 pm

Hello,

The other day, I wanted to look if I could improve monitoring of my ODROID-C2 board. I already have netdata for an "immediate" view, but it does not provide historical data.
To tackle this issue, I decided to mimic what we had at a previous job and setup a Prometheus instance with Grafana.

The thing is: Grafana is in official Arch Linux community, but missing in Arch Linux ARM. All other needed components are available in the ARM repository.

I tried to build it locally, but I do not have enough memory when linking the final binary.
Around IRC, I saw I was not the first person to ask for that package to be compiled, and all previous attempts l saw did go as far as I went, with some out-of-memory errors.

Are there any plans to add that package in the future, provided you have memory for it or that your are okay to cross-compile that one single package on a bigger x86_64 machine?

Thanks!
Barto
 
Posts: 5
Joined: Tue Feb 07, 2017 1:43 pm

Re: Grafana

Postby Barto » Sat Jun 01, 2019 6:00 pm

After quite some time, I was able to spend a little bit of my energy on this issue. Sorry if I'm reviving an old post, but I think this is worthy of an update.

At first, I've tried to run a aarch64 chroot and cross compile the package that x86_64 archlinux provides. But, for some unknown reasons, it didn't work. I didn't get an explicit error, and decided it was not worth trying to understand what was going wrong, provided the final binary may not even run correctly (no complains about qemu, it's just not the same hardware all in all).

Instead, I saw that grafana did ship their own arm binary (for armv6, armv7 and aarch64) and I decided to try to use it instead of being too stubborn trying to compile things. I'd have preferred to have it compiled so that it fits to the target environment better, but oh well...

So in the end, my modified PKGBUILD looks like that:
$this->bbcode_second_pass_code('', '
# Maintainer: Sébastien "Seblu" Luttringer
# Contributor: Carsten Feuls <archlinux@carstenfeuls.de>
# Contributor: Gilles Hamel <hamelg at laposte dot net>

pkgname=grafana
pkgver=6.2.1
pkgrel=1
pkgdesc='Gorgeous metric viz, dashboards & editors for Graphite, InfluxDB & OpenTSDB'
url='https://grafana.com/'
arch=('aarch64')
license=('Apache')
depends=('glibc' 'freetype2' 'fontconfig' 'gsfonts')
backup=('etc/grafana.ini')
source=("https://dl.grafana.com/oss/release/$pkgname-$pkgver.linux-arm64.tar.gz"
'grafana.service'
'grafana.sysusers'
'grafana.tmpfiles'
)
install=$pkgname.install
sha512sums=('04694bd85f0003765ba935abfb4613262129aecefe21e71e148c81ceeaab363299bca794e9d54fbcda3c2d10f0e6394b5ffb7666b07af2cdb88618a6893820b6'
'4663d4f9ccffc3926a0f19088e0efcac76f6d464d7d53e3ecb448fde81ac0855d06935987b11b0608d63c71f76b0b15adce5e6248d28303f1ebb263347094a9a'
'38b46d953837a7afa5a654dfeef163b210d56cad57d937018531d00cd63b5341d6f9cd777299bdc7a994d0cb7df09b8157aad0f166e76ad47564e1ad6d5441d4'
'c1724bfc7cbd6a406f17acb661efca0f1e57e2c30cc1841f4cb7ccfc420adc40cc61cb1c023d00444827b2c40e9caa4c2fefbfd503419848c74a0b455b2375ab')

prepare() {
cd "$pkgname-$pkgver/"
# apply patch from the source array (should be a pacman feature)
local filename
for filename in "${source[@]}"; do
if [[ "$filename" =~ \.patch$ ]]; then
msg2 "Applying patch ${filename##*/}"
patch -p1 -N -i "$srcdir/${filename##*/}"
fi
done
# set arch linux paths
sed -ri 's,^(\s*data\s*=).*,\1 /var/lib/grafana,' conf/defaults.ini
sed -ri 's,^(\s*plugins\s*=).*,\1 /var/lib/grafana/plugins,' conf/defaults.ini
sed -ri 's,^(\s*provisioning\s*=).*,\1 /var/lib/grafana/conf/provisioning,' conf/defaults.ini
sed -ri 's,^(\s*logs\s*=).*,\1 /var/log/grafana,' conf/defaults.ini
}

package() {
install -Dm644 grafana.tmpfiles "$pkgdir/usr/lib/tmpfiles.d/grafana.conf"
install -Dm644 grafana.sysusers "$pkgdir/usr/lib/sysusers.d/grafana.conf"
install -Dm644 grafana.service "$pkgdir/usr/lib/systemd/system/grafana.service"
cd "$pkgname-$pkgver/"
install -Dsm755 bin/grafana-server "$pkgdir/usr/bin/grafana-server"
install -Dsm755 bin/grafana-cli "$pkgdir/usr/bin/grafana-cli"
install -Dm640 -o207 -g207 conf/sample.ini "$pkgdir/etc/$pkgname.ini"
install -Dm644 conf/defaults.ini "$pkgdir/usr/share/$pkgname/conf/defaults.ini"
install -dm755 "$pkgdir/usr/share/grafana/"
for i in scripts public tools; do
cp -r "$i" "$pkgdir/usr/share/grafana/$i"
done
}

# vim:set ts=2 sw=2 et:
')

This way, I was able to create the final package and I can confirm that, so far, everything works.
nampcap indeed spots few sloppy things in the package, but nothing did explode so far:

$this->bbcode_second_pass_code('', '
grafana W: ELF file ('usr/bin/grafana-cli') lacks FULL RELRO, check LDFLAGS.
grafana W: ELF file ('usr/bin/grafana-server') lacks FULL RELRO, check LDFLAGS.
grafana W: ELF file ('usr/bin/grafana-cli') lacks PIE.
grafana W: ELF file ('usr/bin/grafana-server') lacks PIE.
')

So far, it seems I can have grafana, but right now I'd have to manage the updates on my own.

Hope it helps the next guy!
Barto
 
Posts: 5
Joined: Tue Feb 07, 2017 1:43 pm


Return to Package Requests

Who is online

Users browsing this forum: No registered users and 13 guests