Follow

Meter Command Line Tool

Overview

The meter command line tool is a binary packaged with the meter that allows a user to send arbitrary metrics and events to a meter.  The purpose of this tool is to allow users to easily incorporate metrics and events into command line scripts.   The tool uses the command UDP listener channel on the meter.  The default port is 8130, but can be overridden by changing the meter.conf file, and providing the port option on the command line tool.  The tool is a standalone binary and on unix platforms, is called truesight-utils. On windows it is truesight_utils.exe.

The meter command tool was first released in meter version 4.4.1.

General Usage

The usage of the tool is:

truesight-utils [opts] command [args]

The supported opts(all are optional) are:

--version                    print out version information

--help                         print out usage 

--verbose                   enable the truesight-utils to print out diagnose messages

--host=hostname       set the meter host name, default is localhost.

--port=port_number   set to the meter command channel's listening port number, default is 8130

The supported commands are:

send_metric

send_event

Sending Metrics

The send_metric command's valid arguments are:

required arguments:

 -n, --name <metric name>            metric name

 -v, --value <metric value>             metric value

optional arguments:

 -s, --source <metric souce>         metric  source 

 -t, --timestamp <time stamp>       timestamp in ms 

 -p, --props <properties>                comma delimited key/value pair 

 -h, --help                                          print this usage

Example:

truesight-utils send_metric -n TestMetric -v 50

Sending Events

The send_event command's valid arguments are:

required arguments:

 -t, --title <event tile>            The event tile, size limit 255 bytes

optional arguments:

 -m, --message <message>             Message text, limit 255 bytes 

 -s, --severity <event severity>        Event Type. 'info', 'warn', 'error', 'critical'. default is 'info'. 

 --source <source>                           Source that generated the event.  Default is the local node (host) name 

 --sender <sender>                           Sender that generated the message, eg: the plugin name.

 --tags   <tags>                                  A list of comma separated tags in the form of 'tag1,tag2,tag3'

 -p, --props  <properties>                 A list of comma separated K/V paris in the form of 'k1=v1,k2=v2,k3=v3'

 -d, --timestamp <ts>                        Date generated.  Timestamp since Epoch in seconds.

 --at <app data type>                        App data type. Opaque field that is application specific.Used to provide type info for app data.

 --ad <app data>                               App Data.  Application specific data.  In most cases this should be base64 encoded 

 -h, --help                                          print this usage

Example:

truesight-utils send_event -t "a test event" -s error

Code Sample

  • A bash script that will monitor the system log and report sudo violations as events, and count total number of process and send it as metric to meter.

sudo_alert-2.sh (attached)

  • A windows powershell script that will get free memory and report the metric, it will also report the top 5 processes as event to meter.

get_free_mem.ps1 (attached)

 
Have more questions? Submit a request