chronograf: Open source monitoring and visualization UI

This commit is contained in:
Bill Welliver 2019-01-25 21:32:00 -05:00
parent c610c014b8
commit 5272958209
7 changed files with 379 additions and 0 deletions

1
chronograf/DESCR Normal file
View File

@ -0,0 +1 @@
Open source monitoring and visualization UI, part of the InfluxData TICK (telegraf, influxdb, chronograf, kapacitor) stack

139
chronograf/Makefile Normal file
View File

@ -0,0 +1,139 @@
# $NetBSD$
# TODO give startup scripts more attention
# TODO consider changing default internal paths to reflect ${PREFIX}
GITHUB_PROJECT= chronograf
PKGVERSION_NOREV= 1.7.7
DISTNAME= chronograf-1.7.7
GITHUB_TAG= ${PKGVERSION_NOREV}
CATEGORIES= sysutils
MASTER_SITES= ${MASTER_SITE_GITHUB:=influxdata/}
MAINTAINER= william@welliver.org
HOMEPAGE= https://www.influxdata.com/
COMMENT= Monitoring and visualization UI for the TICK stack
LICENSE= gnu-agpl-v3
# despite being the default value, this explicit declaration is required for things
# to build properly.
EXTRACT_SUFX= .tar.gz
CHRONOGRAF_DISTNAME= ${DISTNAME}${EXTRACT_SUFX}
CHRONOGRAF_DEPENDENCIES_DIR= chronograf-dependencies-${PKGVERSION_NOREV}
CHRONOGRAF_DEPENDENCIES= ${CHRONOGRAF_DEPENDENCIES_DIR}${EXTRACT_SUFX}
DISTFILES= ${CHRONOGRAF_DISTNAME}
.if !defined(BOOTSTRAP)
DISTFILES+= ${CHRONOGRAF_DEPENDENCIES}
SITES.${CHRONOGRAF_DEPENDENCIES}= https://bitbucket.org/hww3/influxdb/downloads/
.endif
EXTRACT_DIR.${CHRONOGRAF_DISTNAME}= ${WRKDIR}/src/github.com/influxdata
WRKSRC= ${WRKDIR}/src/github.com/influxdata/chronograf
USE_TOOLS+= gmake curl
USE_LANGUAGES+= c c++
BUILD_DEPENDS+= go110-1.10.*:../../lang/go110
BUILD_DEPENDS+= py27-gyp-[0-9]*:../../devel/gyp
BUILD_DEPENDS+= python27-2.7.*:../../lang/python27
BUILD_DEPENDS+= npm-6.*.*:../../lang/npm
BUILD_DEPENDS+= yarn-1.7.*:../../devel/yarn
# go language executables don't have SSP support
CHECK_SSP_SKIP= bin/*
PKGSRC_MAKE_ENV+= GOPATH=${WRKDIR}
PKGSRC_MAKE_ENV+= GO_BIN=${GO_BIN}
PKGSRC_MAKE_ENV+= PYTHON=${PREFIX}/bin/python2.7
PKGSRC_MAKE_ENV+= YARN_DISABLE_SELF_UPDATE_CHECK="true"
PKG_SYSCONFSUBDIR= chronograf
RESOURCEDIR= ${PREFIX}/share/chronograf
DATADIR= ${VARBASE}/lib/chronograf
LOGDIR= ${VARBASE}/log/chronograf
BUILD_DEFS+= CHRONOGRAF_USER CHRONOGRAF_GROUP VARBASE
FILES_SUBST+= CHRONOGRAF_USER=${CHRONOGRAF_USER:Q}
FILES_SUBST+= CHRONOGRAF_GROUP=${CHRONOGRAF_GROUP:Q}
FILES_SUBST+= DATADIR=${DATADIR:Q}
FILES_SUBST+= LOGDIR=${LOGDIR:Q}
FILES_SUBST+= RESOURCEDIR=${RESOURCEDIR:Q}
CHRONOGRAF_USER?= chronograf
CHRONOGRAF_GROUP?= chronograf
OWN_DIRS_PERMS+= ${DATADIR} ${CHRONOGRAF_USER} ${CHRONOGRAF_GROUP} 0700
OWN_DIRS_PERMS+= ${LOGDIR} ${CHRONOGRAF_USER} ${CHRONOGRAF_GROUP} 0700
PKG_USERS_VARS+= CHRONOGRAF_USER
PKG_GROUPS_VARS+= CHRONOGRAF_GROUP
PKG_GROUPS= ${CHRONOGRAF_GROUP}
PKG_USERS= ${CHRONOGRAF_USER}:${CHRONOGRAF_GROUP}
RCD_SCRIPTS= chronograf
INSTALLATION_DIRS+= bin etc/chronograf share/doc/chronograf share/examples/chronograf share/examples/chronograf/logrotate.d share/chronograf/canned share/chronograf/protoboards
DOC_FILES+= LICENSE LICENSE_OF_DEPENDENCIES.md README.md CHANGELOG.md platform_migrate.md agpl-3.0.md
BIN_FILES+= chronograf chronoctl
GO_BIN= ${PREFIX}/go110/bin/go
CPPFLAGS+= -I${PREFIX}/include/node
CFLAGS+= -I${PREFIX}/include/node
post-extract:
${MV} ${WRKDIR}/src/github.com/influxdata/${DISTNAME} \
${WRKDIR}/src/github.com/influxdata/chronograf
.if !defined(BOOTSTRAP)
${MV} ${WRKDIR}/vendor_js ${WRKSRC}/ui
.endif
# it doesn't seem like there's a way to get yarn to fetch but not build dependencies.
# also, need to figure out a way to get the target dependency to work properly on this make target.
.PHONY: _fetch_dependencies
_fetch_dependencies: extract
cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} ${TOUCH} .godep
cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} ${MKDIR} ${WRKSRC}/vendor_js
cd ${WRKSRC}/ui && ${ECHO} yarn-offline-mirror \"./vendor_js\" > .yarnrc
cd ${WRKSRC}/ui && ${SETENV} ${PKGSRC_MAKE_ENV} yarn --no-progress --no-emoji --offline --verbose
cd ${WRKSRC}/ui && ${SETENV} ${PKGSRC_MAKE_ENV} tar czvf ${CHRONOGRAF_DEPENDENCIES} vendor_js
cd ${WRKSRC}/ui && ${SETENV} ${PKGSRC_MAKE_ENV} mv ${CHRONOGRAF_DEPENDENCIES} /data/pkgsrc/wip/chronograf
# upload the dependency tarball somewhere that others can access.
# this should probably be someplace more "official".
.PHONY: _upload_dependencies
_upload_dependencies: _fetch_dependencies
curl -u $$BITBUCKET_USERNAME:$$BITBUCKET_PASSWORD -s -X POST https://api.bitbucket.org/2.0/repositories/$$BITBUCKET_USERNAME/influxdb/downloads -F files=@${CHRONOGRAF_DEPENDENCIES}
do-build:
touch ${WRKSRC}/.jsdep
touch ${WRKSRC}/.godep
cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} ${GMAKE} .godep
cd ${WRKSRC}/vendor/github.com/kevinburke/go-bindata && ${SETENV} ${PKGSRC_MAKE_ENV} ${GO_BIN} install ./...
cd ${WRKSRC}/ui && ${ECHO} yarn-offline-mirror \"./vendor_js\" > .yarnrc
cd ${WRKSRC}/ui && ${SETENV} ${PKGSRC_MAKE_ENV} CPPFLAGS="${CPPFLAGS}" CFLAGS="${CFLAGS}" yarn --no-progress --no-emoji --offline
cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} PATH=$$PATH:${WRKDIR}/bin ${GMAKE} build
# cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} ${GO_BIN} get -ldflags "-X main.version=${PKGVERSION_NOREV} -X main.commit=${GITHUB_TAG} -X main.buildstamp=pkgsrc" ./...
# cd ${WRKSRC} && ${SETENV} ${PKGSRC_MAKE_ENV} ${GO_BIN} install ./...
do-install:
.for idir in ${INSTALLATION_DIRS}
${MKDIR} ${DESTDIR}${PREFIX}/${idir}
.endfor
.for x in ${BIN_FILES}
${INSTALL} ${WRKSRC}/${x} \
${DESTDIR}${PREFIX}/bin/${x}
.endfor
.for x in ${DOC_FILES}
${INSTALL_DATA} ${WRKSRC}/${x} \
${DESTDIR}${PREFIX}/share/doc/chronograf/${x}
.endfor
for x in ${WRKSRC}/canned/*.json ; do \
${INSTALL_DATA} $$x ${DESTDIR}${PREFIX}/share/${PKGBASE}/canned/ ;\
done
for x in ${WRKSRC}/protoboards/*.json ; do \
${INSTALL_DATA} $$x ${DESTDIR}${PREFIX}/share/${PKGBASE}/protoboards/ ;\
done
.include "../../lang/nodejs/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

90
chronograf/PLIST Normal file
View File

@ -0,0 +1,90 @@
@comment $NetBSD$
bin/chronoctl
bin/chronograf
share/chronograf/canned/apache.json
share/chronograf/canned/consul.json
share/chronograf/canned/consul_agent.json
share/chronograf/canned/consul_cluster.json
share/chronograf/canned/consul_election.json
share/chronograf/canned/consul_http.json
share/chronograf/canned/consul_leadership.json
share/chronograf/canned/consul_serf_events.json
share/chronograf/canned/cpu.json
share/chronograf/canned/disk.json
share/chronograf/canned/diskio.json
share/chronograf/canned/docker.json
share/chronograf/canned/docker_blkio.json
share/chronograf/canned/docker_net.json
share/chronograf/canned/elasticsearch.json
share/chronograf/canned/haproxy.json
share/chronograf/canned/influxdb_database.json
share/chronograf/canned/influxdb_httpd.json
share/chronograf/canned/influxdb_queryExecutor.json
share/chronograf/canned/influxdb_write.json
share/chronograf/canned/kubernetes_node.json
share/chronograf/canned/kubernetes_pod_container.json
share/chronograf/canned/kubernetes_pod_network.json
share/chronograf/canned/kubernetes_system_container.json
share/chronograf/canned/load.json
share/chronograf/canned/mem.json
share/chronograf/canned/memcached.json
share/chronograf/canned/mesos.json
share/chronograf/canned/mongodb.json
share/chronograf/canned/mysql.json
share/chronograf/canned/net.json
share/chronograf/canned/netstat.json
share/chronograf/canned/nginx.json
share/chronograf/canned/nsq_channel.json
share/chronograf/canned/nsq_server.json
share/chronograf/canned/nsq_topic.json
share/chronograf/canned/phpfpm.json
share/chronograf/canned/ping.json
share/chronograf/canned/postgresql.json
share/chronograf/canned/processes.json
share/chronograf/canned/procstat.json
share/chronograf/canned/rabbitmq.json
share/chronograf/canned/redis.json
share/chronograf/canned/riak.json
share/chronograf/canned/varnish.json
share/chronograf/canned/win_cpu.json
share/chronograf/canned/win_mem.json
share/chronograf/canned/win_net.json
share/chronograf/canned/win_system.json
share/chronograf/canned/win_websvc.json
share/chronograf/protoboards/apache.json
share/chronograf/protoboards/consul.json
share/chronograf/protoboards/consul_telemetry.json
share/chronograf/protoboards/docker.json
share/chronograf/protoboards/elasticsearch.json
share/chronograf/protoboards/haproxy.json
share/chronograf/protoboards/iis.json
share/chronograf/protoboards/influxdb.json
share/chronograf/protoboards/kubernetes_node.json
share/chronograf/protoboards/kubernetes_overview.json
share/chronograf/protoboards/kubernetes_pod.json
share/chronograf/protoboards/memcached.json
share/chronograf/protoboards/mesos.json
share/chronograf/protoboards/mongodb.json
share/chronograf/protoboards/mysql.json
share/chronograf/protoboards/nginx.json
share/chronograf/protoboards/nsq.json
share/chronograf/protoboards/phpfpm.json
share/chronograf/protoboards/ping.json
share/chronograf/protoboards/postgresql.json
share/chronograf/protoboards/rabbitmq.json
share/chronograf/protoboards/redis.json
share/chronograf/protoboards/riak.json
share/chronograf/protoboards/system.json
share/chronograf/protoboards/varnish.json
share/chronograf/protoboards/vmware_vsphere_cluster_overview.json
share/chronograf/protoboards/vmware_vsphere_cluster_vms.json
share/chronograf/protoboards/vmware_vsphere_hosts.json
share/chronograf/protoboards/win_system.json
share/doc/chronograf/CHANGELOG.md
share/doc/chronograf/LICENSE
share/doc/chronograf/LICENSE_OF_DEPENDENCIES.md
share/doc/chronograf/README.md
share/doc/chronograf/agpl-3.0.md
share/doc/chronograf/platform_migrate.md
@pkgdir share/examples/chronograf/logrotate.d
@pkgdir etc/chronograf

11
chronograf/distinfo Normal file
View File

@ -0,0 +1,11 @@
$NetBSD$
SHA1 (chronograf-1.7.7.tar.gz) = b192ef8e9ccd9419ae2a187dcf9cf963a34797e3
RMD160 (chronograf-1.7.7.tar.gz) = b3bbcfe0814f0fc976a3c1be2675b98da6a80b73
SHA512 (chronograf-1.7.7.tar.gz) = e8cbb9b1a95e9dac732493dab946cbe1e01a14cb03e20d0a459ba9af489ff8feb128e31a8867cd6936ddc7ffacc2e66a8242e19d9fee4b48c650dfdcad2e4c25
Size (chronograf-1.7.7.tar.gz) = 34562596 bytes
SHA1 (chronograf-dependencies-1.7.7.tar.gz) = bac347e4d9b828d478c38de6ea33ae5eccb298b6
RMD160 (chronograf-dependencies-1.7.7.tar.gz) = 4961bc5f498181815af31f089891c10b138e9531
SHA512 (chronograf-dependencies-1.7.7.tar.gz) = 4390ea826f9f2959b5fe5ad57d19817469dc5af569c90d127f382740ce00a75ea30bd73ac86671bf4180863331624738e372ae2319f7ebd8bd1966809c26ca14
Size (chronograf-dependencies-1.7.7.tar.gz) = 43389651 bytes
SHA1 (patch-Makefile) = 1db15c4569e39e9e77a2365741918c805ad3943f

View File

@ -0,0 +1,22 @@
#!@RCD_SCRIPTS_SHELL@
# PROVIDE: chronograf
# REQUIRE: DAEMON
# KEYWORD: shutdown
if [ -f /etc/rc.subr ]
then
. /etc/rc.subr
fi
name="chronograf"
rcvar=$name
chronograf_user="@CHRONOGRAF_USER@"
chronograf_group="@CHRONOGRAF_GROUP@"
chronograf_chdir="@VARBASE@/lib/chronograf"
STDERR="@LOGDIR@/chronograf.log"
command="@PREFIX@/bin/chronograf"
command_args="-r --canned-path=@RESOURCEDIR@/canned --protoboards-path=@RESOURCEDIR@/protoboards 1>/dev/null 2>> $STDERR &"
load_rc_config $name
run_rc_command "$1"

View File

@ -0,0 +1,30 @@
<?xml version="1.0"?>
<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle.dtd.1">
<service_bundle type='manifest' name='@SMF_NAME@:default'>
<service name='@SMF_PREFIX@/@SMF_NAME@' type='service' version='1'>
<create_default_instance enabled='false' />
<single_instance />
<dependency name='network' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/milestone/network:default' />
</dependency>
<dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local:default' />
</dependency>
<method_context working_directory="@DATADIR@">
<method_credential user='@CHRONOGRAF_USER@' group='@CHRONOGRAF_GROUP@' />
</method_context>
<exec_method type='method' name='start'
exec='@PREFIX@/bin/chronograf -r --protoboards-path=@RESOURCEDIR@/protoboards --canned-path=@RESOURCEDIR@/canned 2>> @LOGDIR@/chronograf.log &amp;'
timeout_seconds="60" />
<exec_method type='method' name='stop' exec=':kill' timeout_seconds="60" />
<template>
<common_name>
<loctext xml:lang='C'>Kapacitor metrics monitoring agent</loctext>
</common_name>
<documentation>
<manpage title='chronograf' section='1' manpath='/@PREFIX@/man' />
<doc_link name='homepage' uri='https://docs.influxdata.com/chronograf/' />
</documentation>
</template>
</service>
</service_bundle>

View File

@ -0,0 +1,86 @@
$NetBSD$
go becomes GO_BIN
--- Makefile.orig 2019-01-16 21:16:18.000000000 +0000
+++ Makefile
@@ -2,7 +2,7 @@
VERSION = 1.7.7
COMMIT ?= $(shell git rev-parse --short=8 HEAD)
-GOBINDATA := $(shell go list -f {{.Root}} github.com/kevinburke/go-bindata 2> /dev/null)
+GOBINDATA := $(shell ${GO_BIN} list -f {{.Root}} github.com/kevinburke/go-bindata 2> /dev/null)
YARN := $(shell command -v yarn 2> /dev/null)
SOURCES := $(shell find . -name '*.go' ! -name '*_gen.go' -not -path "./vendor/*" )
@@ -20,8 +20,8 @@ all: dep build
build: assets ${BINARY}
${BINARY}: $(SOURCES) .bindata .jsdep .godep
- go build -o ${BINARY} ${LDFLAGS} ./cmd/chronograf/main.go
- go build -o ${CTLBINARY} ${LDFLAGS} ./cmd/chronoctl
+ ${GO_BIN} build -o ${BINARY} ${LDFLAGS} ./cmd/chronograf/main.go
+ ${GO_BIN} build -o ${CTLBINARY} ${LDFLAGS} ./cmd/chronoctl
define CHRONOGIRAFFE
._ o o
@@ -38,7 +38,7 @@ chronogiraffe: ${BINARY}
@echo "$$CHRONOGIRAFFE"
docker-${BINARY}: $(SOURCES)
- CGO_ENABLED=0 GOOS=linux go build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
+ CGO_ENABLED=0 GOOS=linux ${GO_BIN} build -installsuffix cgo -o ${BINARY} ${LDFLAGS} \
./cmd/chronograf/main.go
docker: dep assets docker-${BINARY}
@@ -50,19 +50,19 @@ assets: .jssrc .bindata
@touch .bindata
dist/dist_gen.go: $(UISOURCES)
- go generate -x ./dist
+ ${GO_BIN} generate -x ./dist
server/swagger_gen.go: server/swagger.json
- go generate -x ./server
+ ${GO_BIN} generate -x ./server
canned/bin_gen.go: canned/*.json
- go generate -x ./canned
+ ${GO_BIN} generate -x ./canned
protoboards/bin_gen.go: protoboards/*.json
- go generate -x ./protoboards
+ ${GO_BIN} generate -x ./protoboards
.jssrc: $(UISOURCES)
- cd ui && yarn run clean && yarn run build
+ cd ui && yarn --offline run clean && yarn --offline run build
@touch .jssrc
dep: .jsdep .godep
@@ -70,7 +70,7 @@ dep: .jsdep .godep
.godep:
ifndef GOBINDATA
@echo "Installing go-bindata"
- go get -u github.com/kevinburke/go-bindata/go-bindata
+ ${GO_BIN} get -u github.com/kevinburke/go-bindata/go-bindata
endif
@touch .godep
@@ -85,15 +85,15 @@ endif
gen: internal.pb.go
internal.pb.go: bolt/internal/internal.proto
- go generate -x ./bolt/internal
+ ${GO_BIN} generate -x ./bolt/internal
test: jstest gotest gotestrace lint-ci
gotest:
- go test -timeout 10s ./...
+ ${GO_BIN} test -timeout 10s ./...
gotestrace:
- go test -race ./...
+ ${GO_BIN} test -race ./...
jstest:
cd ui && yarn test --runInBand