Installation and Deployment

This chapter provides a step-by-step guide to installing and deploying CPDS.

Installing CPDS

This section covers the steps to install CPDS components.

  1. Install cpds-agent.

    cpds-agent gathers raw data from nodes and can be installed independently on multiple nodes.

    shell
    yum install cpds-agent
  2. Install cpds-detector.

    shell
    yum install cpds-detector
  3. Install cpds-analyzer.

    shell
    yum install cpds-analyzer
  4. Install cpds-dashboard.

    shell
    yum install cpds-dashboard
  5. Install Cpds.

    shell
    yum install Cpds

Deployment of CPDS

This section explains the configuration and deployment of CPDS.

Configuration Overview

cpds-agent Configuration

cpds-agent collects node network information by sending ICMP packets to a specified IP address. The net_diagnostic_dest field must specify a reachable IP address, not the local node IP address. You are advised to set the master node IP address on worker nodes and any worker node IP address on the master.

bash
vim /etc/cpds/agent/config.json
json
{
    "expose_port":"20001", # Port to listen on
    "log_cfg_file": "/etc/cpds/agent/log.conf",
    "net_diagnostic_dest": "192.30.25.18" # Destination IP address for ICMP packets
}

Prometheus Configuration

CPDS uses Prometheus to collect raw data generated by cpds-agent. cpds-agent opens port 20001 by default. Edit the Prometheus configuration file to connect to cpds-agent for data collection.

bash
vim /etc/prometheus/prometheus.yml
yaml
global:
  scrape_interval: 2s
  evaluation_interval: 3s
scrape_configs:
  - job_name: "cpds"
    static_configs:
    - targets: ["cpds-agent1:port","cpds-agent2:port","..."] # IP addresses and ports of deployed cpds-agent instances

cpds-detector Configuration

bash
vim /etc/cpds/detector/config.yml
yaml
generic:
  bindAddress: "127.0.0.1" # Address to listen on
  port: 19091 # Port to listen on

database:
  host: "127.0.0.1" # Database IP address
  port: 3306 # Database port
  username: root # Database username
  password: root # Database password
  maxOpenConnections: 123 # Maximum number of connections

prometheus:
  host: "127.0.0.1" # Detector IP address
  port: 9090 # Prometheus port

log:
  fileName: "/var/log/cpds/cpds-detector/cpds-detector.log"
  level: "warn"
  maxAge: 15
  maxBackups: 100
  maxSize: 100
  localTime: true
  compress: true

cpds-analyzer Configuration

bash
vim /etc/cpds/analyzer/config.yml
yaml
generic:
  bindAddress: "127.0.0.1" # Address to listen on
  port: 19091 # Port to listen on

database:
  host: "127.0.0.1" # Database IP address
  port: 3306 # Database port
  username: root # Database username
  password: root # Database password
  maxOpenConnections: 123 # Maximum number of connections

detector:
  host: "127.0.0.1" # Detector IP address
  port: 19092 # Detector port

log:
  fileName: "/var/log/cpds/cpds-analyzer/cpds-analyzer.log"
  level: "warn"
  maxAge: 15
  maxBackups: 100
  maxSize: 100
  localTime: true

cpds-dashboard Configuration

bash
vim /etc/nginx/conf.d/cpds-ui.conf
conf
server {
  listen 10119;

  location / {
    root /etc/cpds/cpds-ui/;
    index index.html index.htm;
  }

  location /api/ {
    proxy_pass http://127.0.0.1:19091; # Backend analyzer IP address and port
  }

  location /websocket/ {
    proxy_pass http://127.0.0.1:19091; # Backend analyzer IP address and port
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-Proto http;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";
  }
}

Starting CPDS

This section outlines the steps to start CPDS.

Disabling the Firewall

shell
systemctl stop firewalld
systemctl disable firewalld

Set the SELINUX status to disabled in the /etc/selinux/config file.

conf
SELINUX=disabled

Restart the system to apply the changes.

Initializing the Database

  1. Start the database service.

    shell
    systemctl start mariadb.service
    systemctl enable mariadb.service
  2. Initialize the database with root privileges.

    shell
    /usr/bin/mysql_secure_installation

    During the process, you will be prompted to enter the root user password for the database. If no password is set, press Enter and follow the prompts to configure the settings.

  3. Configure database connection permissions.

    shell
    mysql -u root -p

    Enter the password set in the previous step when prompted.

    shell
    GRANT ALL PRIVILEGES ON *.* TO 'username'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;

    Replace username with the database username and password with the corresponding password.

    For example:

    shell
    mysql -u root -p
    Enter password:
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 5
    Server version: 10.5.16-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
    Query OK, 0 rows affected (0.014 sec)

Starting the Service

shell
systemctl start Cpds.service
systemctl enable Cpds.service

Start cpds-agent on all nodes.

shell
systemctl start cpds-agent
systemctl enable cpds-agent

Accessing the Frontend Management Platform

Once the services are running, open a browser and navigate to http://localhost:10119 to access the frontend management platform.