Skip to content

infrasonar/discovery-agent

Repository files navigation

CI Release Version

InfraSonar Discovery Agent

Documentation: https://docs.infrasonar.com/collectors/agents/discovery/

Environment variables

Environment Default Description
NETWORK required Network to scan. For example 192.168.0.1/24.
DAEMON 0 Start the agent as daemon when set to 1. If not (0), the agent will run only once.
CONFIG_PATH /etc/infrasonar Path where configuration files are loaded and stored (note: for a user, the $HOME path will be used instead of /etc)
TOKEN required Token used for authentication (This MUST be a container token).
ASSET_NAME none Initial Asset Name. This will only be used at the announce. Once the asset is created, ASSET_NAME will be ignored.
ASSET_ID none Asset Id (If not given, the asset Id will be stored and loaded from file).
API_URI https://api.infrasonar.com InfraSonar API.
SKIP_VERIFY none Set to 1 or something else to skip certificate validation.
CHECK_NMAP_INTERVAL 14400 Interval in seconds for namp check or 0 to disable the check.

Download

If your platform is not listed above, refer to the build from source section for instructions.

Docker

Latest stable release

docker pull ghcr.io/infrasonar/discovery-agent:latest

Unstable release

docker pull ghcr.io/infrasonar/discovery-agent:unstable

Build from source

CGO_ENABLED=0 go build -trimpath -o discovery-agent

Schedule

Copy the binary to /usr/sbin/infrasonar-discovery-agent

sudo cp discovery-agent /usr/sbin/infrasonar-discovery-agent

Using Systemd

sudo touch /etc/systemd/system/infrasonar-discovery-agent.service
sudo chmod 664 /etc/systemd/system/infrasonar-discovery-agent.service

1. Using you favorite editor, add the content below to the file created:

[Unit]
Description=InfraSonar Discovery Agent
Wants=network.target

[Service]
EnvironmentFile=/etc/infrasonar/discovery-agent.env
ExecStart=/usr/sbin/infrasonar-discovery-agent

[Install]
WantedBy=multi-user.target

2. Create the directory /etc/infrasonar

sudo mkdir /etc/infrasonar

3. Create the file /etc/infrasonar/discovery-agent.env with at least:

TOKEN=<YOUR TOKEN HERE>

Optionaly, add environment variable to the discovery-agent.env file for settings like ASSET_ID or CONFIG_PATH (see all environment variables in the table above).

4. Reload systemd:

sudo systemctl daemon-reload

5. Install the service:

sudo systemctl enable infrasonar-discovery-agent

Finally, you may want to start/stop or view the status:

sudo systemctl start infrasonar-discovery-agent
sudo systemctl stop infrasonar-discovery-agent
sudo systemctl status infrasonar-discovery-agent

View logging:

journalctl -u infrasonar-discovery-agent