Skip to main content

Configuration

You can upload any collected data from the WhaTap project. Focus can be used even if the default agent has not been installed for the project.

Checking the project access key and collection server IP

In Management > Agent Installation for the selected project, check the project code, collection server IP, and project access key.

SH
export WHATAP_LICENSE=xxxx-xxxxxx-xxxxxx
export WHATAP_HOST=xxxx.xxxx.xxxx
export WHATAP_PCODE=xxx

Adding specific tags for filtering

You can set specific strings as tags for filtering. Through the settings, you can filter the data collected from the WhaTap monitoring service screen by the name and value for the tag.

SH
# -tag.[User tag key name][Blank][User tag value]

./focus -license $WHATAP_LICENSE \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-tag.CustomTagName CustomTagValue \
-tag.MyServer1 server_01 \
...

Sending alerts

Custom alerts can be sent immediately. After sending an alert, the Focus is ended.

SH
#Select a severity of the alert.
level={info|warn|fatal}
#Alert title
title=Desired alert title
#Alert body
message=Desired alert body
./focus -license $WHATAP_LICENSE \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-alert -level $level -title $title -message $message

Collecting the SQL query result

It collects the execution results of custom SQL queries in time series indefinitely.

SH
#Metric category
category=my_category
#Database driver
driver={mysql|postgres}
#Database connection info
dburl="ID:password@tcp(IP:Port)/Database"
#Sql Query
sqlquery="select some, columns from sometable"
./focus -license $WHATAP_LICENSE \
-category $category \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-rdb $driver -rdb.connect $dburl \
-rdb.sql $sqlquery

Collecting the keyword matching logs of the log file

If a keyword is included when a log occurs in the specified text log file, the log line is collected.

SH
#Metric category
category=my_category
#Log file
LOG_FILE=Log file path
#Delimiter to use between keywords when entering multiple log keywords
LOG_KEYWORDS_SEPERATOR=,
#Enter log keywords by using the delimiter (,).
LOG_KEYWORDS=keyword1,keyword2
./focus -license $WHATAP_LICENSE \
-category $category \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-tail $LOG_FILE \
-tail.keys $LOG_KEYWORDS \
-tail.seperator $LOG_KEYWORDS_SEPERATOR

WhaTap log analyzing service

When a log occurs in the specified text log file, it is uploaded in real time to the WhaTap log analysis service.

SH
#Category
category=my_category
#Can include the log file wildcard (*) and date pattern (http://strftime.org)
LOG_FILE=log file path
./focus -license $WHATAP_LICENSE \
-category $category \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-logsink $LOG_FILE

Collecting the OS resource usage

It collects the resource usage of the server on which Focus is running.

Linux Shell
#Metric category
category=my_category
#Whether or not to enable the disk monitoring
diskenabled=true|false
#Disk mount to monitor
diskmount=/mypartition
#Whether or not to enable the NIC monitoring
nicenabled=true|false
#NIC to monitor
nic=eth0

./focus -license $WHATAP_LICENSE \
-category $category \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-sys \
-sys.disk.enabled $diskenabled \
-sys.disk $diskmount \
-sys.net.enabled $nicenabled \
-sys.net $nic

Collecting results of running the temporary programs and scripts

It runs programs and scripts and continuously collects results to stdout. WhaTap Focus collects the keys and values of the dictionary when any value is input to stdin in the json dictionary format. Because the pipe is to be used as an input method, it is required to disable buffering.

Note
  • For continuous collection instead of one-time collection, you can apply the following option. -onetime
  • To specify the collection time, you can enter it with the following option. -now {unix epoch time(second)}
Linux Shell
#Metric category
CATEGORY="my_category"


Program or script | \
Reprocessing in the json format | \
./focus -license $WHATAP_LICENSE \
-category $category \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST

The following example executes the top command to continuously collect the CPU and memory usage of a specific process.

Linux Shell
#Metric category
CATEGORY="my_category"

export PID=PID of the process to collect
top -b -p $PID | awk '/'$PID'/{ printf "{\"pid\": %s, \"cpuPercent\": %s, \"memoryPercent\": %s, \"cmd\": \"%s\"}\n",$1, $9, $10, $12}; system("")' | \
./focus -license $WHATAP_LICENSE \
-pcode $WHATAP_PCODE -server.host $WHATAP_HOST \
-category $CATEGORY