Skip to content

infrasonar/qstar-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI Release Version

InfraSonar QStar Agent

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

Environment variables

Environment Default Description
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.
LOG_DATE_FMT 01/02/2006 15:04:05.999999 Use this format to read the timestamp from syslog.
LOG_FILE_PATH /opt/QStar/log/syslog QStar syslog file.
LOG_BUF_SIZE 8192 Read this size from the log file (at the end of the file).
CHECK_QSTAR_INTERVAL 300 Interval in seconds for the qstar check.
CHECK_LOG_INTERVAL 300 Interval in seconds for the log check.

Build

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

Installation

Download the latest release:

$ wget https://github.com/infrasonar/qstar-agent/releases/download/v0.1.0/qstar-agent

The pre-build binary is build for the linux-amd64 platform. For other platforms build from source using the command: CGO_ENABLED=0 go build -o qstar-agent

Ensure the binary is executable:

chmod +x qstar-agent

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

$ sudo cp qstar-agent /usr/sbin/infrasonar-qstar-agent

Using Systemd

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

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

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

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

[Install]
WantedBy=multi-user.target

2. Create the file /etc/infrasonar/qstar-agent.env with at least:

TOKEN=<YOUR TOKEN HERE>

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

3. Reload systemd:

$ sudo systemctl daemon-reload

4. Install the service:

$ sudo systemctl enable infrasonar-qstar-agent

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

$ sudo systemctl start infrasonar-qstar-agent
$ sudo systemctl stop infrasonar-qstar-agent
$ sudo systemctl status infrasonar-qstar-agent

View logging:

$ journalctl -u infrasonar-qstar-agent

mmparam not found If the mmparam command is not found, this might be a problem with the path settings. As a solution a short link can be created:

ln -s /opt/QStar/bin/mmparam /usr/sbin/mmparam