{"id":5970,"date":"2020-05-31T14:31:16","date_gmt":"2020-05-31T11:31:16","guid":{"rendered":"https:\/\/kifarunix.com\/?p=5970"},"modified":"2024-03-14T20:29:00","modified_gmt":"2024-03-14T17:29:00","slug":"monitor-system-metrics-with-tick-stack-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/monitor-system-metrics-with-tick-stack-on-ubuntu-20-04\/","title":{"rendered":"Monitor System Metrics with TICK Stack on Ubuntu 20.04"},"content":{"rendered":"\n
In this tutorial, we are going to learn how to monitor system metrics with TICK stack on Ubuntu 20.04. TICK stack is an acronym for a collection of opensource tools including T<\/strong>elegraf, I<\/strong>nfluxDB, C<\/strong>hronograf and K<\/strong>apacitor. Each of these tools offers different functionality:<\/p>\n\n\n\n As much as these components inter-operate, you can use each one of them separately in standalone setup.<\/p>\n\n\n\n We covered the installation and setup of TIG stack on Ubuntu 20.04 in our previos guide, which shares the same components as TICK stack except that it uses Grafana instead of Chronograf and it doesnt use Kapacitor.<\/p>\n\n\n\n Install and Setup TIG Stack on Ubuntu 20.04<\/a><\/p>\n\n\n\n In order to setup TICK Stack to monitor system metrics on Ubuntu 20.04, we will install and setup each of the components individually.<\/p>\n\n\n\n We already covered the installation and configuration of InfluxDB on Ubuntu 20.04 in our previous guide on TIG stack.<\/p>\n\n\n\n How to install InfluxDB on Ubuntu 20.04<\/a><\/p>\n\n\n\n Configure InfluxDB to store Metrics collected by Telegraf<\/a><\/p>\n\n\n\n To further configure InfluxDB, we are going to enable HTTP authentication. This can be done by uncommenting the line, Note that in the InfluxDB configuration guide above, we created a user, Before you can enable InfluxDB HTTP authentication, you need to have at least one administrative user on the database. Create admin user as follows;<\/p>\n\n\n\n To list users;<\/p>\n\n\n\n Next, enable HTTP authentication.<\/p>\n\n\n\n Save and exit the configuration file and restart InfluxDB service.<\/p>\n\n\n\n Follow the links below to install and configure of Telegraf.<\/p>\n\n\n\n How to install Telegraf on Ubuntu 20.04<\/a><\/p>\n\n\n\n How to configure Telegraf to collect system metrics on Ubuntu 20.04<\/a><\/p>\n\n\n\n Since we have enabled InfluxDB HTTP user authentication, ensure that you define the InfluxDB database username and password on Telegraf configuration.<\/p>\n\n\n\n Restart Telegraf;<\/p>\n\n\n\n You can install Kapacitor on Ubuntu 20.04 from the InfluxData repositories or you can simply download the debian binary package file and install it.<\/p>\n\n\n\n Create InfluxData repository and install Kapacitor;<\/p>\n\n\n\n Download Kapacitor from InfluxData downloads page<\/a>.<\/p>\n\n\n\n Open the Kapacitor configuration file and define the InfluxDB HTTP authentication credentials.<\/p>\n\n\n\n You can display Kapacitor configuration using;<\/p>\n\n\n\n To use Kapacitor with an InfluxDB instance that requires authentication, it must authenticate using an InfluxDB user with <\/em>read and write<\/strong> permissions.<\/em><\/p>\n<\/blockquote>\n\n\n\n Once done with configuration, start and enable Kapacitor to run on system boot;<\/p>\n\n\n\n Verify the status;<\/p>\n\n\n\n You can as well check Kapacitor tasks;<\/p>\n\n\n\n Similarly, Chronograf can be installed either using the debian package file or from the InfluxData repos created above.<\/p>\n\n\n\n To install from InfluxData repos;<\/p>\n\n\n\n If you want to install using the debian package file;<\/p>\n\n\n\n Chronograf is started and enabled to run on system boot after installation.<\/p>\n\n\n\n Further configuration of Chronograf can be finalized from the browser.<\/p>\n\n\n\n If UFW is running, open Chronograf TCP port 8888 to allow external access.<\/p>\n\n\n\n Access Chronograf using the address, Enter the Telegraf database and username connection details. Leave the retention policy to go with the default policy settings.<\/p>\n\n\n\n Click Add Connection<\/strong> to connect to Telegraf database. If the credentials provided are correct, you should see a message stating successful connection.<\/p>\n\n\n\n Next, select the dashboard from the provided list. In our case, we will chose the suggested system<\/strong> dashboard.<\/p>\n\n\n\n Click on the dashboard and click Create Dashboard<\/strong>.<\/p>\n\n\n\n Next, connect Chronograf to Kapacitor. Set the name of Kapacitor. For credentials, since we didn’t set any, just leave them blank.<\/p>\n\n\n\n Click Continue<\/strong> to configure the connection. If all is well, you should see a connection success message.<\/p>\n\n\n\n The setup is now complete. Click View All Connections<\/strong> to see all InfluxDB connections.<\/p>\n\n\n\n Click on the Chronograf dashboards icon.<\/p>\n\n\n\n Select system<\/strong> dashboard to view system metrics.<\/p>\n\n\n\n And there you go. Beautiful, isn’t?<\/p>\n\n\n\n That is just it on our tutorial on how to monitor system metrics with TICK stack. Stay tuned for more related tutorials.<\/p>\n\n\n\n InfluxData Documentation<\/a><\/p>\n\n\n\n Install and Setup TIG Stack on Fedora 30<\/a><\/p>\n\n\n\n Install and Setup Kolide Fleet on Ubuntu 18.04<\/a><\/p>\n\n\n\n\n
Monitoring System Metrics with TICK Stack<\/h2>\n\n\n\n
Install InfluxDB on Ubuntu 20.04<\/h3>\n\n\n\n
Enable InfluxDB HTTP Authentication<\/a><\/h4>\n\n\n\n
auth-enabled = false<\/strong><\/code>, under the
[http]<\/code> section on influxdb configuration file and setting the value to
true<\/strong><\/code>.<\/p>\n\n\n\n
telegraf<\/code>, with all privileges granted on the database,
telegraf<\/code>. You will need to specify this username and password in the Telegraf configuration file, InfluxDB output section.<\/p>\n\n\n\n
influx<\/code><\/pre>\n\n\n\n
use telegraf<\/code><\/pre>\n\n\n\n
create user admin with password 'myAdminP@ssword' with all privileges<\/code><\/pre>\n\n\n\n
show users<\/code><\/pre>\n\n\n\n
user admin\n---- -----\ntelegraf false\nadmin true<\/strong><\/code><\/pre>\n\n\n\n
vim \/etc\/influxdb\/influxdb.conf<\/code><\/pre>\n\n\n\n
[http]\n # Determines whether HTTP endpoint is enabled.\n enabled = true\n...\n # The bind address used by the HTTP service.\n bind-address = \":8086\"\n\n # Determines whether user authentication is enabled over HTTP\/HTTPS.\n auth-enabled = true<\/strong><\/code><\/pre>\n\n\n\n
systemctl restart influxdb<\/code><\/pre>\n\n\n\n
Install and Configure Telegraf on Ubuntu 20.04<\/h3>\n\n\n\n
vim \/etc\/telegraf\/telegraf.conf<\/code><\/pre>\n\n\n\n
...\n[[outputs.influxdb]]\n urls = [\"http:\/\/127.0.0.1:8086\"]\n database = \"telegraf\"\n username = \"telegraf\"\n password = \"myP@SSword\"<\/strong>\n...<\/code><\/pre>\n\n\n\n
systemctl restart telegraf<\/code><\/pre>\n\n\n\n
Install and Configure Kapacitor on Ubuntu 20.04<\/a><\/h3>\n\n\n\n
Install Kapacitor from InfluxData repos<\/h4>\n\n\n\n
wget -qO- https:\/\/repos.influxdata.com\/influxdb.key | sudo apt-key add -<\/code><\/pre>\n\n\n\n
source \/etc\/lsb-release<\/code><\/pre>\n\n\n\n
echo \"deb https:\/\/repos.influxdata.com\/${DISTRIB_ID,,} ${DISTRIB_CODENAME} stable\" | sudo tee \/etc\/apt\/sources.list.d\/influxdb.list<\/code><\/pre>\n\n\n\n
apt update<\/code><\/pre>\n\n\n\n
apt install kapacitor<\/code><\/pre>\n\n\n\n
Install Kapacitor using Debian Package file<\/h4>\n\n\n\n
wget https:\/\/dl.influxdata.com\/kapacitor\/releases\/kapacitor_1.5.5-1_amd64.deb<\/code><\/pre>\n\n\n\n
dpkg -i kapacitor_1.5.5-1_amd64.deb<\/code><\/pre>\n\n\n\n
Configure Kapacitor<\/h4>\n\n\n\n
vim \/etc\/kapacitor\/kapacitor.conf<\/code><\/pre>\n\n\n\n
...\n[[influxdb]]\n # Connect to an InfluxDB cluster\n # Kapacitor can subscribe, query and write to this cluster.\n # Using InfluxDB is not required and can be disabled.\n enabled = true\n default = true\n name = \"localhost\"\n urls = [\"http:\/\/localhost:8086\"]\n username = \"admin\"\n password = \"myAdminP@ssword\"<\/strong>\n timeout = 0\n...<\/code><\/pre>\n\n\n\n
kapacitord config<\/code><\/pre>\n\n\n\n
\n
systemctl enable --now kapacitor<\/code><\/pre>\n\n\n\n
systemctl status kapacitor<\/code><\/pre>\n\n\n\n
\u25cf kapacitor.service - Time series data processing engine.\n Loaded: loaded (\/lib\/systemd\/system\/kapacitor.service; enabled; vendor preset: enabled)\n Active: active (running) since Sun 2020-05-31 10:01:00 UTC; 2min 2s ago\n Docs: https:\/\/github.com\/influxdb\/kapacitor\n Main PID: 13967 (kapacitord)\n Tasks: 10 (limit: 2282)\n Memory: 11.3M\n CGroup: \/system.slice\/kapacitor.service\n \u2514\u250013967 \/usr\/bin\/kapacitord -config \/etc\/kapacitor\/kapacitor.conf\n\nMay 31 10:01:00 ubuntu20 systemd[1]: Started Time series data processing engine..\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: '##:::'##::::'###::::'########:::::'###:::::'######::'####:'########::'#######::'########::\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: ##::'##::::'## ##::: ##.... ##:::'## ##:::'##... ##:. ##::... ##..::'##.... ##: ##.... ##:\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: ##:'##::::'##:. ##:: ##:::: ##::'##:. ##:: ##:::..::: ##::::: ##:::: ##:::: ##: ##:::: ##:\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: #####::::'##:::. ##: ########::'##:::. ##: ##:::::::: ##::::: ##:::: ##:::: ##: ########::\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: ##. ##::: #########: ##.....::: #########: ##:::::::: ##::::: ##:::: ##:::: ##: ##.. ##:::\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: ##:. ##:: ##.... ##: ##:::::::: ##.... ##: ##::: ##:: ##::::: ##:::: ##:::: ##: ##::. ##::\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: ##::. ##: ##:::: ##: ##:::::::: ##:::: ##:. ######::'####:::: ##::::. #######:: ##:::. ##:\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: ..::::..::..:::::..::..:::::::::..:::::..:::......:::....:::::..::::::.......:::..:::::..::\nMay 31 10:01:00 ubuntu20 kapacitord[13967]: 2020\/05\/31 10:01:00 Using configuration at: \/etc\/kapacitor\/kapacitor.conf<\/code><\/pre>\n\n\n\n
kapacitor list tasks<\/code><\/pre>\n\n\n\n
ID Type Status Executing Databases and Retention Policies<\/strong><\/code><\/pre>\n\n\n\n
Install and Configure Chronograf on Ubuntu 20.04<\/h3>\n\n\n\n
apt install chronograf<\/code><\/pre>\n\n\n\n
wget https:\/\/dl.influxdata.com\/chronograf\/releases\/chronograf_1.8.4_amd64.deb<\/code><\/pre>\n\n\n\n
dpkg -i chronograf_1.8.4_amd64.deb<\/code><\/pre>\n\n\n\n
Running Chronograf<\/h4>\n\n\n\n
systemctl status chronograf<\/code><\/pre>\n\n\n\n
\u25cf chronograf.service - Open source monitoring and visualization UI for the entire TICK stack.\n Loaded: loaded (\/lib\/systemd\/system\/chronograf.service; enabled; vendor preset: enabled)\n Active: active (running) since Sun 2020-05-31 10:10:31 UTC; 1min 4s ago\n Docs: https:\/\/www.influxdata.com\/time-series-platform\/chronograf\/\n Main PID: 14214 (chronograf)\n Tasks: 8 (limit: 2282)\n Memory: 17.0M\n CGroup: \/system.slice\/chronograf.service\n \u2514\u250014214 \/usr\/bin\/chronograf\n\nMay 31 10:10:31 ubuntu20 systemd[1]: Started Open source monitoring and visualization UI for the entire TICK stack..\nMay 31 10:10:37 ubuntu20 chronograf[14214]: time=\"2020-05-31T10:10:37Z\" level=info msg=\"Serving chronograf at http:\/\/[::]:8888\" component=server\n...<\/code><\/pre>\n\n\n\n
systemctl is-enabled chronograf<\/code><\/pre>\n\n\n\n
enabled<\/strong><\/code><\/pre>\n\n\n\n
Configuring Chronograf<\/h4>\n\n\n\n
Open Chronograf Port on Firewall<\/h5>\n\n\n\n
ufw allow 8888\/tcp<\/code><\/pre>\n\n\n\n
Accessing Chronograf Web UI<\/h5>\n\n\n\n
http:\/\/server-IP-or-resolvable-hostname:8888<\/code><\/strong>. On Chronograf dashboard, click Get Started<\/strong>.<\/p>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Viewing Chronograf System Dashboards<\/h4>\n\n\n\n
<\/figure>\n\n\n\n
<\/figure>\n\n\n\n
Further Reading<\/h3>\n\n\n\n
Related Tutorials<\/h3>\n\n\n\n