Skip to content

ALTIBASE/telegraf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to build Telegraf embedded the Altibase Input Plugin

Telegraf utilizes input plugins to collect metrics from target systems. Among these, the Altibase input plugin for Telegraf serves the purpose of collecting metrics from an Altibase database system.

This document describes the sequential steps to compile Telegraf embedded the Altibase input plugin. Following successful compilation, refer to the Altibase Input Plugin for configuration and execution instructions.

1. Intall and configure unixODBC

The Altibase input plugin is connected to an Altibase database system through unixODBC. Therefore, it is mandatory to install a unixODBC and configure environment variables for the Altibase input plugin to reference unixODBC.

It is recommended to install the unixODBC-2.3.12 version for enhanced compatibility. This version can be downloaded from the official unixODBC homepage.

After installation, set environment variables as follows:

export UNIX_ODBC="unixODBC installed path"
export LD_LIBRARY_PATH="$UNIX_ODBC/lib:$LD_LIBRARY_PATH"
export ODBCINI=${UNIX_ODBC}/etc/odbc.ini

To establish a connection between the installed unixODBC and the Altibase server, further configuration is necessary. As this process falls beyond the scope of this guide, please refer to the unixODBC Guide for Altibase (Korean) for detailed instructions.

2. Clone the Telegraf repository

Clone the Telegraf repository using the following command:

git clone https://github.com/influxdata/telegraf.git telegraf

The latest Telegraf version compatible with the Altibase input plugin is v1.30.2.

3. Clone the Altibase input plugin repository

Clone the Altibase input plugin repository with the following command:

git clone https://github.com/ALTIBASE/telegraf.git telegraf_altibase

The latest version of the Altibase input plugin is v1.0.0.

4. Copy the Altibase input plugin into the Telegraf input plugin directory

Copy the Altibase input plugin into the Telegraf input plugin directory using the following command:

cp telegraf_altibase/all/altibase.go telegraf/plugins/inputs/all
cp -r telegraf_altibase/altibase telegraf/plugins/inputs

5. Modifiy Makefile

The Makefile is located in the root directory where the Telegraf repository was cloned.

Modify the Makefile by setting CGO_ENABLE=1 since the Altibase input plugin requires cgo.

...
.PHONY: build
build:
        CGO_ENABLED=1 go build -tags "$(BUILDTAGS)" -ldflags "$(LDFLAGS)" ./cmd/telegraf
...
$(buildbin):
        echo $(GOOS)
        @mkdir -pv $(dir $@)
        CGO_ENABLED=1 go build -o $(dir $@) -tags "$(BUILDTAGS)" -ldflags "$(LDFLAGS)" ./cmd/telegraf

6. Compile Telegraf embedded the Altibase input plugin

Before compiling Telegraf with the embedded Altibase input, you need to set some environment variables.

The required settings depend on the SQLLEN size of unixODBC. Check the SQLLEN size by executing the command below:

${UNIX_ODBC}/bin/odbcinst -j

Then, set the environment variables according to the SQLLEN size.

If SQLLEN=8:

export CGO_CFLAGS="-I$UNIX_ODBC/include"
export CGO_LDFLAGS="-L$UNIX_ODBC/lib"

If SQLLEN=4:

export CGO_CFLAGS="-I$UNIX_ODBC/include -DBUILD_LEGACY_64_BIT_MODE=1"
export CGO_LDFLAGS="-L$UNIX_ODBC/lib -lodbc"

Finally, navigate to the Telegraf directory and execute the following command to compile Telegraf with the embedded the Altibase input plugin:

cd telegraf
go get github.com/alexbrainman/odbc
make build

About

Altibase input plugin for Telegraf

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages