Skip to content

AgentUserGuide.wiki

Gerrit Jansen van Vuuren edited this page Apr 13, 2016 · 1 revision

Agent User Guide

Overview

The agent is used to send new files or new file data automatically and continuously to the collector. This means application log data gets collected as they are logged.

Each agent provides two interfaces for monitoring:

  1. Command line unix style interface
  2. Rest Web Service interface

Command line

The command line interface is accessed via the /opt/streams-agent/bin/streams.sh script:

Typing in -help or nothing prints the below help screen:


agent commands:

 -agentStatus          Queries agent process
 -count <status>       [READY, READING, DELETED, CHANGED, DONE,
                       READ_ERROR]
 -from <from>          from position (integer)
 -help
 -json                 prints to json format
 -ls <status>          [READY, READING, DELETED, CHANGED, DONE,
                       READ_ERROR]
 -max <max>            max results position (integer)
 -o                    Use only when the agent is not running use with ls,
                       status, update to connect to the database directory
                       and not via rest
 -query <query>        jpa query string e.g. lastModificationTime < 1000
                       or path='test1.txt'
 -start <command>      e.g. agent will start the agent
 -status <file name>
 -stop <command>       e.g. agent will stop the agent
 -update <file name>
 -values <values>      key[=:]value[,;]key=value ( fields supported are
                       e.g.
                       path=test2.txt,logType=logType2,fileSize=2,filePoin
                       ter=3,lastModificationTime=4,linePointer=5,status=D
                       ONE)

Agent Command List

Command Options Output
streams.sh -agentStatus prints out the json format for the agent status e.g. {"status":"OK","statusMessage":"Working"}
streams.sh -ls [<status>] [-from <number>] [-max <number>] [-json] [-o] Will output a list of files that the agent has detected and the file, line pointers and file size. This enabled you to see how file transfers are going. Use the -o parameter when the agent is not running
streams.sh -count [<status>] [-o] Counts the number of files, e.g. to count all files type streams.sh -count, to count the number of files the agent has sent type streams.sh -count DONE , use the -o parameter when the agent is not running
streams.sh -start agent starts the agent instance, this is good for testing but its better practice to use the init scripts
streams.sh -stop agent stops the agent instance, this is good for testing but its better practice to use the init scripts
streams.sh -update <filename> -values "<values>" This command updates the file metadata stored by the agent. This command is not supported yet and considered experimental.

Rest Interface

All rest communication is done using Json and standard Http Rest.

URL Description
http://<host>:8085/agent/status Shows the agent status and counters
http://<host>:8085/files/list Lists all files the agent has seen
http://<host>:8085/files/list/<status> List all files the agent has sent
http://<host>:8085/files/count Count all files that the agent has seen
http://<host>:8085/files/count/<status> Count all files that the agent has seen
http://<host>:8085/files/actions/ Shows the current actions to be run
http://<host>:8085/config Shows the agent configuration

The status values allowed are:

READY Files that an agent still has to send
READING Files that the agent is sending
DONE Files that the agent has sent
ERROR Files that the agent has marked as error e.g. the file was truncated