Installation of InfluxDB Kapacitor
Overview
The recommended method to install additional software on a Nodegrid appliance is through docker
containers. This capability is available on all appliances.
InfluxDB Kapacitor is a distributed data collector and aggregator that works with InfluxDB's telegraf agent, which is natively available on Nodegrid.
To collect and aggregate data in a local environment before sending the data to the backend database might be required to install Kapacitor on one or multiple Nodegrid appliances.
As Kapacitor is a self-contained application written in golang
and supports Linux, can the application be installed directly on Nodegrid without the need to deploy it as a docker container?
Customers can as well deploy the docker version of Kapacitor. Follow the official docker installation instruction of Nodegrid OS and Kapacitor.
This guide covers the required installation steps to install the kapacitor service and how to run the service at start-up.
Depending on the use case, customers can install software binaries as part of a specific user or for global installation as root users. However, this guide assumes the packages will be installed by the default admin account as root user.
Reference:
Installation
The installation requires the following steps:
- Get the Download link for Kapacitor
- Connect to Nodegrid root shell
- Download Kapacitor to Nodegrid OS
- Updating the users PATH variable to include InfluxDB Kapacitor
- Create init.d start-up script
- Adding init.d start/stop/status script to system start-up
The following table outlines the most common details and commands.
Setting | Value | Commands | Comments |
---|---|---|---|
Kapacitor Download | kapacitor-1.6.6_linux_amd64.tar.gz | wget https://dl.influxdata.com/kapacitor/releases/kapacitor-1.6.6_linux_amd64.tar.gz |
for version 1.6.1 |
Connect to Nodegrid root shell | shell sudo su - |
||
install directory | /var/opt/kapacitor | mkdir /var/opt/kapacitor |
|
start at boot up | init.d script | vi /etc/init.d/kapacitor |
see below for an example script and setup |
system path | create symlink | update-rc.d kapacitor defaults |
Get the Download link for Kapacitor
- Navigtae to Kapacitor download page
- Look under InfluxDB Version 1 for the current Kapacitor download version. Select as Platform Linux Binaries (64-bit)
- Copy and Note the URL for the download, for example:
https://dl.influxdata.com/kapacitor/releases/kapacitor-1.6.6_linux_amd64.tar.gz
Connect to Nodegrid root shell
- Open a cli connection as admin user
- switch the root shell with the following command
shell sudo su -
Download and Install Kapacitor to Nodegrid OS
- Download the tar.gz file to Nodegrdi using the noted URL
wget https://dl.influxdata.com/kapacitor/releases/kapacitor-1.6.6_linux_amd64.tar.gz
tar xvfz kapacitor-1.6.6_linux_amd64.tar.gz -C /var/opt/
ln -s /var/opt/kapacitor /var/opt/kapacitor-1.6.6-1
Updating the user's PATH variable to include kapacitor
This must be executed for each user who requires access to the application. By default, this is only required for the root user. Copy the following commands into the user shell
new_path="/var/opt/kapacitor/usr/bin/"
if [[ ":$PATH:" == *":$new_path:"* ]]; then
echo "The new path is already in the PATH variable."
else
echo "export PATH=\"$new_path:\$PATH\"" >> ~/.bashrc
export PATH="$new_path:$PATH"
echo "The PATH variable has been updated."
fi
Create default Kapacitor configuration
- Create a default configuration with the following command
kapacitord config > /var/opt/kapacitor/kapacitor.conf
- Adjust the configuration file as required with
vi /var/opt/kapacitor/kapacitor.conf
Create init.d start-up script
- create an init.d start/stop the script with
vi /etc/init.d/kapacitord
- File content, adjust the required sections
#!/bin/bash
### BEGIN INIT INFO
# Provides: kapacitord
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs $network
# Default-Start: 5
# Default-Stop: 0 1 6
# Short-Description: InfluxDB kapacitord service
# Description: This is a init.d script to start and stop InfluxDB's kapacitord
# Update the section start()/stop()/status() as needed
### END INIT INFO
# Path to the service executable
SERVICE_PATH="/var/opt/kapacitor/usr/bin/kapacitord"
CONFIGURATION_FILE="/var/opt/kapacitor/kapacitor.conf"
SERVICE_NAME="kapacitord"
# Command to start the service
start() {
if [ -f "$SERVICE_PATH" ]; then
echo "Starting $SERVICE_NAME..."
"$SERVICE_PATH" -config "$CONFIGURATION_FILE" > /dev/null 2>&1 &
else
echo "Service executable not found: $SERVICE_PATH"
fi
}
# Command to stop the service
stop() {
echo "Stopping $SERVICE_NAME..."
pkill -f "$SERVICE_PATH"
}
# Command to check the status of the service
status() {
if pgrep -f "$SERVICE_PATH" >/dev/null; then
echo "$SERVICE_NAME* is running."
else
echo "$SERVICE_NAME is not running."
fi
}
# Handle command-line arguments
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 1
start
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
- make file executable
chmod +x /etc/init.d/kapacitord
- Adding init.d start/stop/status script to system start-up
update-rc.d kapacitord defaults
Start kapacitord
- to start or stop the service use the following commands
- to start
/etc/init.d/kapacitord start
- to status
/etc/init.d/kapacitord status
- to stop
/etc/init.d/kapacitord stop