ossobv / gocollect

Data collector using go, periodically posts json to a REST api

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GoCollect

bettercodehub goreportcard

GoCollect collects various pieces of system info and publishes them to a central server.

The intent of GoCollect is to create a map of your servers with slow and never changing data items. Where you may use Zabbix for semi-realtime monitoring of integer values like current CPU usage, you use GoCollect to collect values like hard drive serial numbers, IPMI IP-addresses and versions of installed OS packages.

Installing

make && make install
cp /etc/gocollect.conf.sample /etc/gocollect.conf
# edit /etc/gocollect.conf
# then start/restart gocollect using your favorite init method

You may need to set up a go path first:

mkdir -p ~/go
export GOPATH=~/go

And check this out inside that:

git clone https://github.com/ossobv/gocollect \
  $GOPATH/src/github.com/ossobv/gocollect

And install prerequisites:

go get github.com/ossobv/go-getopt

Possibly set env to old style module handling:

# go.mod file not found in current directory or any parent directory...
go env -w GO111MODULE=off  # sets ~/.config/go/env: GO111MODULE=off

Packaging for Debian

Prerequisites:

$ sudo apt-get install git-buildpackage dh-make dh-systemd

Optional:

$ cat > .git/gbp.conf << EOF
[DEFAULT]
upstream-branch=main
debian-branch=debian

[buildpackage]
upstream-tag = v%(version)s
EOF

Running:

$ git checkout debian
$ gbp buildpackage -sa \
    --git-debian-branch=debian --git-upstream-tag='v%(version)s'

Note that release candidate versions must be tagged as v1.2_rc3. gbp-buildpackage rewrites the underscore to a debian-style tilde. Pre-release development versions shall be called v1.3_dev which sorts before v1.3_rc1, which in turn sorts before v1.3.

Packaging a tarball

To to create a tarball with the latest version, including a config file, do this:

$ cd gocollect-client
$ TGZ_CONFIG=/path/to/gocollect.conf make tgz
...
Created: gocollect-v0.4~rc6+1.g83d4-md5conf-c0f48c3.tar.gz

You can then extract and run that archive on the target machine like this:

$ cat gocollect-v0.4~rc6+1.g83d4-md5conf-c0f48c3.tar.gz | sudo tar -xzvC /
$ sudo /etc/init.d/gocollect start

You may need to install additional dependencies first to get all collectors to work properly. For example smartmontools or ipmitool.

Golang notes to self

License

The source code is licensed according to the GNU GPLv3+; see LICENSE.

The artwork – the GoCollect logo – is licensed according to the Attribution-NonCommercial-ShareAlike 4.0 International Creative Commons license (CC BY-NC-SA 4.0); see LICENSE.CC.BY-NC-SA.4-0.txt.

About

Data collector using go, periodically posts json to a REST api

License:GNU General Public License v3.0


Languages

Language:Python 35.6%Language:Shell 35.2%Language:Go 22.2%Language:Makefile 4.7%Language:Roff 2.0%Language:Dockerfile 0.4%