-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add VictoriaMetrics package, a time series database.
Package multiple pieces of the Prometheus compatible VictoriaMetrics suite: - victoria-metrics - vmagent - vmbackup - vmrestore - vmctl Whilst here, correct a minor spelling error in functions.sh.
- Loading branch information
Showing
9 changed files
with
363 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
#!/usr/bin/bash | ||
# | ||
# {{{ CDDL HEADER | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# }}} | ||
|
||
# Copyright 2024 Guo-Rong Koh | ||
|
||
. ../../lib/build.sh | ||
|
||
PROG=victoriametrics | ||
VER=1.102.1 | ||
PKG=ooce/database/victoriametrics | ||
SUMMARY="VictoriaMetrics" | ||
DESC="Fast, cost-effective monitoring solution and time series database." | ||
|
||
DATA=var/lib/victoria-metrics-data | ||
|
||
set_arch amd64 | ||
set_gover | ||
|
||
XFORM_ARGS=" | ||
-DPREFIX=${PREFIX#/} | ||
-DPROG=$PROG | ||
-DUSER=$PROG | ||
-DGROUP=$PROG | ||
-DDATA=$DATA | ||
-DVERSION=$VER | ||
-DVM=victoria-metrics | ||
-DVMAGENT=vmagent | ||
" | ||
|
||
build() { | ||
pushd $TMPDIR/$BUILDDIR > /dev/null | ||
|
||
logmsg "Building $PROG" | ||
export CGO_ENABLED=0 | ||
export GOOS=illumos | ||
|
||
logcmd gmake victoria-metrics-pure || logerr "Unable to build victoria-metrics-pure" | ||
logcmd gmake vmutils-pure || logerr "Unable to build vmutils-pure" | ||
|
||
popd >/dev/null | ||
} | ||
|
||
# make it so | ||
init | ||
clone_go_source VictoriaMetrics VictoriaMetrics v$VER | ||
prep_build | ||
build | ||
install_go bin/victoria-metrics-pure victoria-metrics | ||
install_go bin/vmagent-pure vmagent | ||
install_go bin/vmbackup-pure vmbackup | ||
install_go bin/vmctl-pure vmctl | ||
install_go bin/vmrestore-pure vmrestore | ||
xform files/$PROG-template.xml > $TMPDIR/$PROG.xml | ||
install_smf application $PROG.xml | ||
xform files/victoria-metrics-profile-template.xml > $TMPDIR/victoria-metrics-profile.xml | ||
add_notes README.install | ||
make_package | ||
clean_up | ||
|
||
# Vim hints | ||
# vim:ts=4:sw=4:et:fdm=marker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
----------------------------------------- | ||
VictoriaMetrics and vmagent Configuration | ||
----------------------------------------- | ||
|
||
VictoriaMetrics and vmagent are not configured by configuration files. | ||
Configuration is achieved via command-line arguments or equivalent environment variables. | ||
|
||
For SMF service integration, service profiles with appropriate environment variables can be used. | ||
Example profiles are provided in `<prefix>/share/victoriametrics`. | ||
|
||
These can edited and applied with: | ||
``` | ||
svcadm apply victoria-metrics-profile.xml | ||
svcadm apply vmagent-profile.xml | ||
``` | ||
|
||
vmagent _requires_ at least the envvar `VM_remoteWrite_url`, an example is provided that can be applied. |
40 changes: 40 additions & 0 deletions
40
build/victoriametrics/files/victoria-metrics-profile-template.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | ||
<!-- | ||
This file and its contents are supplied under the terms of the | ||
Common Development and Distribution License ("CDDL"), version 1.0. | ||
You may only use this file in accordance with the terms of version | ||
1.0 of the CDDL. | ||
A full copy of the text of the CDDL should have accompanied this | ||
source. A copy of the CDDL is also available via the Internet at | ||
http://www.illumos.org/license/CDDL. | ||
Copyright 2024 OmniOS Community Edition (OmniOSce) Association. | ||
--> | ||
<service_bundle type="profile" | ||
name="victoriametrics"> | ||
|
||
<service name="application/victoriametrics" | ||
type="service" | ||
version="1"> | ||
|
||
<instance name="victoria-metrics"> | ||
<method_context> | ||
<method_environment> | ||
<envvar name="VM_storageDataPath" | ||
value="/$(DATA)" /> | ||
<envvar name="VM_retentionPeriod" | ||
value="90d" /> | ||
<envvar name="VM_selfScrapeInterval" | ||
value="60s" /> | ||
</method_environment> | ||
</method_context> | ||
|
||
</instance> | ||
|
||
</service> | ||
|
||
</service_bundle> |
162 changes: 162 additions & 0 deletions
162
build/victoriametrics/files/victoriametrics-template.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,162 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | ||
<!-- | ||
This file and its contents are supplied under the terms of the | ||
Common Development and Distribution License ("CDDL"), version 1.0. | ||
You may only use this file in accordance with the terms of version | ||
1.0 of the CDDL. | ||
A full copy of the text of the CDDL should have accompanied this | ||
source. A copy of the CDDL is also available via the Internet at | ||
http://www.illumos.org/license/CDDL. | ||
Copyright 2024 OmniOS Community Edition (OmniOSce) Association. | ||
--> | ||
<service_bundle type="manifest" | ||
name="victoriametrics"> | ||
|
||
<service name="application/victoriametrics" | ||
type="service" | ||
version="1"> | ||
|
||
<instance name="victoria-metrics" | ||
enabled="false"> | ||
|
||
<dependency name="loopback" | ||
grouping="require_any" | ||
restart_on="error" | ||
type="service"> | ||
<service_fmri value="svc:/network/loopback" /> | ||
</dependency> | ||
|
||
<dependency name="network" | ||
grouping="optional_all" | ||
restart_on="error" | ||
type="service"> | ||
<service_fmri value="svc:/milestone/network" /> | ||
</dependency> | ||
|
||
<dependency name="filesystem_local" | ||
grouping="require_all" | ||
restart_on="none" | ||
type="service"> | ||
<service_fmri value="svc:/system/filesystem/local:default" /> | ||
</dependency> | ||
<method_context> | ||
<method_credential user="$(USER)" | ||
group="$(GROUP)" | ||
privileges="basic,net_privaddr" /> | ||
<method_environment> | ||
<envvar name="VM_storageDataPath" | ||
value="/$(DATA)" /> | ||
</method_environment> | ||
</method_context> | ||
|
||
<exec_method type="method" | ||
name="start" | ||
exec="%{config/exec} -envflag.enable -envflag.prefix=VM_" | ||
timeout_seconds="60"></exec_method> | ||
|
||
<exec_method type="method" | ||
name="stop" | ||
exec=":kill" | ||
timeout_seconds="300" /> | ||
|
||
<property_group name="config" | ||
type="application"> | ||
<propval name="exec" | ||
type="astring" | ||
value="/$(PREFIX)/bin/$(VM)" /> | ||
</property_group> | ||
|
||
<property_group name="startd" | ||
type="framework"> | ||
<propval name="duration" | ||
type="astring" | ||
value="child" /> | ||
<propval name="ignore_error" | ||
type="astring" | ||
value="core,signal" /> | ||
</property_group> | ||
|
||
<template> | ||
<common_name> | ||
<loctext xml:lang="C">VictoriaMetrics server | ||
$(VERSION)</loctext> | ||
</common_name> | ||
</template> | ||
|
||
</instance> | ||
|
||
<instance name="vmagent" | ||
enabled="false"> | ||
|
||
<dependency name="loopback" | ||
grouping="require_any" | ||
restart_on="error" | ||
type="service"> | ||
<service_fmri value="svc:/network/loopback" /> | ||
</dependency> | ||
|
||
<dependency name="network" | ||
grouping="optional_all" | ||
restart_on="error" | ||
type="service"> | ||
<service_fmri value="svc:/milestone/network" /> | ||
</dependency> | ||
|
||
<dependency name="filesystem_local" | ||
grouping="require_all" | ||
restart_on="none" | ||
type="service"> | ||
<service_fmri value="svc:/system/filesystem/local:default" /> | ||
</dependency> | ||
<method_context> | ||
<method_credential user="$(USER)" | ||
group="$(GROUP)" | ||
privileges="basic,net_privaddr" /> | ||
</method_context> | ||
|
||
<exec_method type="method" | ||
name="start" | ||
exec="%{config/exec} -envflag.enable -envflag.prefix=VM_" | ||
timeout_seconds="60"></exec_method> | ||
|
||
<exec_method type="method" | ||
name="stop" | ||
exec=":kill" | ||
timeout_seconds="300" /> | ||
|
||
<property_group name="config" | ||
type="application"> | ||
<propval name="exec" | ||
type="astring" | ||
value="/$(PREFIX)/bin/$(VMAGENT)" /> | ||
</property_group> | ||
|
||
<property_group name="startd" | ||
type="framework"> | ||
<propval name="duration" | ||
type="astring" | ||
value="child" /> | ||
<propval name="ignore_error" | ||
type="astring" | ||
value="core,signal" /> | ||
</property_group> | ||
|
||
<template> | ||
<common_name> | ||
<loctext xml:lang="C">VictoriaMetrics agent | ||
$(VERSION)</loctext> | ||
</common_name> | ||
</template> | ||
|
||
</instance> | ||
|
||
<stability value="External" /> | ||
|
||
</service> | ||
|
||
</service_bundle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1"> | ||
<!-- | ||
This file and its contents are supplied under the terms of the | ||
Common Development and Distribution License ("CDDL"), version 1.0. | ||
You may only use this file in accordance with the terms of version | ||
1.0 of the CDDL. | ||
A full copy of the text of the CDDL should have accompanied this | ||
source. A copy of the CDDL is also available via the Internet at | ||
http://www.illumos.org/license/CDDL. | ||
Copyright 2024 OmniOS Community Edition (OmniOSce) Association. | ||
--> | ||
<service_bundle type="profile" | ||
name="victoriametrics"> | ||
|
||
<service name="application/victoriametrics" | ||
type="service" | ||
version="1"> | ||
|
||
<instance name="vmagent"> | ||
<method_context> | ||
<method_environment> | ||
<envvar name="VM_remoteWrite_url" | ||
value="http://localhost:8428/api/v1/write" /> | ||
</method_environment> | ||
</method_context> | ||
|
||
</instance> | ||
|
||
</service> | ||
|
||
</service_bundle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
|
||
# Copyright 2024 Guo-Rong Koh | ||
|
||
license LICENSE license=Apache2 | ||
|
||
dir path=$(DATA) owner=$(USER) group=$(GROUP) mode=0700 | ||
|
||
group groupname=$(GROUP) gid=93 | ||
user ftpuser=false username=$(USER) uid=93 group=$(GROUP) \ | ||
gcos-field="VictoriaMetrics - time series database" \ | ||
home-dir=/$(DATA) password=NP | ||
|
||
file ./tmp/victoria-metrics-profile.xml \ | ||
path=$(PREFIX)/share/$(PROG)/victoria-metrics-profile.xml \ | ||
owner=$(USER) group=$(GROUP) mode=0444 | ||
file files/vmagent-profile.xml \ | ||
path=$(PREFIX)/share/$(PROG)/vmagent-profile.xml \ | ||
owner=$(USER) group=$(GROUP) mode=0444 | ||
|
||
<transform file path=$(PREFIX)/bin/victoria-metrics -> \ | ||
set restart_fmri svc:/application/$(PROG):victoria-metrics> | ||
<transform file path=$(PREFIX)/bin/vmagent -> \ | ||
set restart_fmri svc:/application/$(PROG):vmagent> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters