Skip to content

Collector Setup

Introduction

This article will help you setup a new collector, either on the Nanitor server or on a fresh machine. This should work on either CentOS/RedHat type flavors or Debian flavors, although these instructions have only been validated on CentOS 7.

All instruction assume you are logged in as root, use sudo if you are not.

Install the Collector

Install the actual collector software. For Centos

yum install -y https://hub.nanitor.com/files/yum/nanitor-collector.rpm

For Debian

curl -o /tmp/nanitor-collector.deb https://hub.nanitor.com/files/deb/nanitor-collector.deb
apt install -y /tmp/nanitor-collector.deb

Get Signup URL

In order to connect the collector to the right instance you need a signup URL

The Signup URL is the same Signup URL as you use for Agent installation. To get it go to the download screen in admin section and click on the key.

Connecting the collector

To setup and connect the collector to your instance issue the following commands. Make sure to adjust the organization title, collector name and supply the signup URL you copied above in for the demo URL after key file argument.

/usr/lib/nanitor-collector/bin/nanitor-collector-ctl collector_signup --name CollectorName --keyfile https://acme.nanitor.com/api/agent_get_signup_key/xxx-xxx-xxx-xxx
systemctl enable nanitor-collector.service
systemctl start nanitor-collector.service

Verification

If all went well, you should now have a new collector in your collector screen. Here is screenshot of a system with a new collector named Siggitest

Troubleshooting

Make sure the Nanitor server and Collector are running the same version, minor version mismatch usually isn't an issue but there might be changes in the collector that are not backwards compatible.

Check that the collector service is started and restart it for good measure

systemctl status nanitor-collector.service
systemctl start nanitor-collector.service

On the Nanitor server make sure the collector socket service is running

systemctl status nanitor-collector-socket.service

On the Nanitor server make sure /etc/nginx/conf.d/nanitor.conf has the following

location /collector_socket/ {
        proxy_redirect off;
        proxy_set_header   Host             $host;
        proxy_set_header   X-Real-IP        $remote_addr;
        proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        proxy_set_header   X-Forwarded-Proto https;
        proxy_set_header X-Forwarded-Ssl on;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection “Upgrade”;
        proxy_http_version 1.1;
        proxy_pass http://127.0.0.1:8164/;
    }

Rehoming

If you need to move the collector to a new instance or re-register it for some reason run the following command

sudo rm -fR /var/lib/nanitor/collector/nanitor-collector.db
Then follow the instructions in the connection paragraph above. Make sure to restart the collector service after you rehome.

systemctl restart nanitor-collector.service