We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

25
1.331.928,75

Cart

Quantity 2.750,00
Quantity 24.100,00

Learn how to – Monitor Applications and Troubleshoot issues using SigNoz

Learn how to – Monitor Applications and Troubleshoot issues using SigNoz.

Monitoring is one of the most vital tasks in an IT environment. This is because most businesses nowadays largely rely on applications to operate. The health and performance of the applications need to be monitored frequently to resolve errors or send alerts to the response team as soon as they occur. There are several monitoring stacks one can use to monitor their systems. The most popular stacks are Elastic Stack, Nagios, Zenoss, N-able RMM, PRTG Network Monitor, Prometheus, Datadog Infrastructure Monitoring, Zabbix, New Relic, Dynatrace e.t.c

In this guide, we will learn how to monitor applications and troubleshoot issues using SigNoz. SigNoz is an open-source performance monitoring tool that makes it easy to monitor and troubleshoot problems on your applications.

SigNoz works by collecting data using OpenTelemetry(an open-source observability solution). Therefore, it supports all the languages and frameworks supported by OpenTelemetry. The most popular languages include NodeJS, Python, Java, Go e.t.c. Once collected, SigNoz aggregates the data and displays the metrics and traces via dashboards.

The below diagram is a simple illustration of how SigNoz works.

The SigNoz comprises of:

  • OpenTelemetry Collector: This collects telemetry data from your services and applications.
  • ClickHouse: This is an open-source, high-performance columnar OLAP database management system.
  • Frontend: This is the user interface, built-in ReactJS, and TypeScript.
  • Query Service: This is the interface between the front end and ClickHouse

With SigNoz, users are able to:

  • Track user requests across services and figure out issues in downstream services, slow DB queries, call to 3rd party services like payment gateways, etc
  • Set alerts on metrics
  • Monitor infrastructure metrics such as CPU utilization or memory usage
  • Monitor application metrics such as latency, requests per second, error rates
  • View detailed flame graphs of individual request traces
  • Identify the root cause of the problem by going to the exact traces which are causing the problem

Getting Started

SigNoz can be installed on Docker Standalone, Docker Swarm, and Kubernetes. In this guide, we will go for the Docker Standalone installation.

This method requires:

  • Linux or macOS machine
  • A minimum of 4GB of memory must be allocated to Docker.
  • Git client installed
  • Ports 3301, 4317 and 4318 are available on the machine where you install SigNoz.
  • On macOS, you must manually install Docker Engine before you run the install script. The install script automatically installs Docker Engine on Linux.

1. Install SigNoz on Docker

There are two methods for installing SigNoz on Docker. These are:

  • Executing a script that checks your environment, installs Docker Engine and Docker Compose on Linux, and runs the docker compose up command for you.
  • Manually execute docker compose up

Option 1 – Using the Automatic Install Script

The installer is supported on Ubuntu, Debian, OpenSuse, CentOS, and SUSE Linux Enterprise Server (SLES). Begin by cloning the SigNoz repository using the command:

git clone -b main https://github.com/SigNoz/signoz.git

Navigate into the directory;

cd signoz/deploy/

Now execute the installer:

sudo ./install.sh

Sample Output:

Add your system user to the docker group:

sudo usermod -aG docker $USER
newgrp docker

Verify the installation

$ docker ps
CONTAINER ID   IMAGE                                          COMMAND                  CREATED              STATUS                        PORTS                                                           NAMES
75c0e4c4d156   signoz/frontend:0.11.2                         "nginx -g 'daemon of…"   About a minute ago   Up About a minute             80/tcp, 0.0.0.0:3301->3301/tcp, :::3301->3301/tcp               frontend
b5293861e63c   signoz/alertmanager:0.23.0-0.2                 "/bin/alertmanager -…"   About a minute ago   Up About a minute             9093/tcp                                                        clickhouse-setup_alertmanager_1
5314d888ad64   signoz/signoz-otel-collector:0.55.3            "/signoz-collector -…"   About a minute ago   Up About a minute             0.0.0.0:4317-4318->4317-4318/tcp, :::4317-4318->4317-4318/tcp   clickhouse-setup_otel-collector_1
309e1070be57   signoz/query-service:0.11.2                    "./query-service -co…"   About a minute ago   Up About a minute (healthy)   8080/tcp                                                        query-service
a93f617ecccc   signoz/signoz-otel-collector:0.55.3            "/signoz-collector -…"   About a minute ago   Up About a minute             4317-4318/tcp                                                   clickhouse-setup_otel-collector-metrics_1
05b279dec9d7   clickhouse/clickhouse-server:22.4.5-alpine     "/entrypoint.sh"         2 minutes ago        Up 2 minutes (healthy)        8123/tcp, 9000/tcp, 9009/tcp                                    clickhouse-setup_clickhouse_1
187a24d4e3be   grubykarol/locust:1.2.3-python3.9-alpine3.12   "/docker-entrypoint.…"   2 minutes ago        Up 2 minutes                  5557-5558/tcp, 8089/tcp                                         load-hotrod
db35fd182bae   jaegertracing/example-hotrod:1.30              "/go/bin/hotrod-linu…"   2 minutes ago        Up 2 minutes                  8080-8083/tcp                                                   hotrod

Option 2 – Using Docker Compose

Here, you need to manually install Docker installed on your system. The below guide can be used to install docker on Linux.

Once installed, ensure that the service is started and enabled:

sudo systemctl start docker && sudo systemctl enable docker

Add the system user to the docker group.

sudo usermod -aG docker $USER
newgrp docker

Also, install docker-compose with the aid provided in the guide:

Once installed, clone the repository;

git clone -b main https://github.com/SigNoz/signoz.git && cd signoz/deploy/

Now run the container with the command:

docker-compose -f docker/clickhouse-setup/docker-compose.yaml up -d

Check if the containers are up;

$ docker ps
CONTAINER ID   IMAGE                                          COMMAND                  CREATED              STATUS                        PORTS                                                           NAMES
f8d879ed6d21   signoz/frontend:0.11.2                         "nginx -g 'daemon of…"   About a minute ago   Up 2 seconds                  80/tcp, 0.0.0.0:3301->3301/tcp, :::3301->3301/tcp               frontend
aa416e3e92de   signoz/alertmanager:0.23.0-0.2                 "/bin/alertmanager -…"   About a minute ago   Up 3 seconds                  9093/tcp                                                        clickhouse-setup-alertmanager-1
22fd8a795c2c   signoz/signoz-otel-collector:0.55.3            "/signoz-collector -…"   About a minute ago   Up 33 seconds                 4317-4318/tcp                                                   clickhouse-setup-otel-collector-metrics-1
b7a765b95741   signoz/query-service:0.11.2                    "./query-service -co…"   About a minute ago   Up 34 seconds (healthy)       8080/tcp                                                        query-service
366bd2c49c9c   signoz/signoz-otel-collector:0.55.3            "/signoz-collector -…"   About a minute ago   Up 33 seconds                 0.0.0.0:4317-4318->4317-4318/tcp, :::4317-4318->4317-4318/tcp   clickhouse-setup-otel-collector-1
80fb2290ea26   jaegertracing/example-hotrod:1.30              "/go/bin/hotrod-linu…"   About a minute ago   Up About a minute             8080-8083/tcp                                                   hotrod
618a89e68c23   grubykarol/locust:1.2.3-python3.9-alpine3.12   "/docker-entrypoint.…"   About a minute ago   Up About a minute             5557-5558/tcp, 8089/tcp                                         load-hotrod
98b9d39db570   clickhouse/clickhouse-server:22.4.5-alpine     "/entrypoint.sh"         About a minute ago   Up About a minute (healthy)   8123/tcp, 9000/tcp, 9009/tcp                                    clickhouse-setup-clickhouse-1

2. Access SigNoz Dashboard

Once the containers have been deployed, allow port 3301 through the firewall;

##For UFW
sudo ufw allow 3301

##For Firewalld
sudo firewall-cmd --add-port=3301/tcp --permanent
sudo firewall-cmd --reload

Now access the SigNoz dashboard with the URL http://IP_Address:3301

Create an account as shown.

Once authenticated, you will see the below dashboard.

3. Instrument and monitor Applications with SigNoz

Instrumentation is the process of enabling the application code to generate telemetry data. This helps monitor and measure the performance and state of your application. For this guide, we will demonstrate how to implement NodeJS instrumentation, though several others such as Java, Python, Golang PHP, Ruby e.t.c are supported.

Create a Simple NodeJS application

Ensure that NodeJS is installed on your system. For example NodeJS 16

##On Debian/Ubuntu
curl -sL https://deb.nodesource.com/setup_16.x | sudo bash -
sudo apt -y install nodejs

##On RHEL/CentOS/Rocky Linux
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
sudo dnf install nodejs

Verify the installation.

$ node -v
v16.18.0

$ npm -v
8.19.2

Clone a simple NodeJS application repo:

git clone https://github.com/SigNoz/sample-nodejs-app.git

Navigate into the directory:

cd sample-nodejs-app

You will realize that there are two files here:

  • index.js for our simple Hello World application running on port 9090
  • tracing.js for telemetry collection

Install all the required packages

npm i 

Allow the required ports through the firewall:

##For UFW
sudo ufw allow 4317
sudo ufw allow 9090

##For Firewalld
sudo firewall-cmd --add-port=4317/tcp --permanent
sudo firewall-cmd --add-port=9090/tcp --permanent
sudo firewall-cmd --reload

To start the application and metrics collection, we will use the command:

OTEL_EXPORTER_OTLP_ENDPOINT="<IP of SigNoz>:4317" OTEL_RESOURCE_ATTRIBUTES=service.name=nodeJsApp node -r ./tracing.js index.js

In the above command, replace:

  • IP of SigNoz: localhost (since we are running SigNoz on our local host)
  • service.name: nodeJsApp (you can give whatever name suits you)

Therefore the command will be;

OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317" OTEL_RESOURCE_ATTRIBUTES=service.name=nodeJsApp node -r ./tracing.js index.js

Now the application should be running on port 9090 and can be accessed with the URL http://IP_Address:9090/hello

Hit this endpoint severally to generate some data. After some time, access the SigNoz dashboard open the Services tab, and hit Refresh. You will see the application appear as shown below.

Now you can view graphs for the application and identify the events causing high latency, the key operations, and percentage errors by clicking on the application.

You can also create dashboards and configure alerting on SigNoz and also configure instrumentation for other languages.

Verdict

This guide has provided the basic knowledge required to monitor applications and troubleshoot issues using SigNoz. You can now explore other functionalities on your own. I hope this was insightful.

See more:

25
1.331.928,75

Cart

Quantity 2.750,00
Quantity 24.100,00