A powerful telemetry framework
The snap-telemetry
package installs snaptel
in /usr/local/sbin/snaptel
, and snapteld
in /usr/local/sbin/snapteld
. Either ensure /usr/local/bin:/usr/local/sbin
is in your path, or use fully qualified filepath to the snaptel
/snapteld
binary:
$ snaptel [global options] command [command options] [arguments...]
--url, -u 'http://localhost:8181' Sets the URL to use [$SNAP_URL]
--insecure Ignore certificate errors when Snap's API is running HTTPS [$SNAP_INSECURE]
--api-version, -a 'v1' The Snap API version [$SNAP_API_VERSION]
--password, -p Require password for REST API authentication [$SNAP_REST_PASSWORD]
--config, -c Path to a config file [$SNAPTEL_CONFIG_PATH]
--help, -h show help
--version, -v print the version
metric
plugin
task
help, h Shows a list of commands or help for one command
$ snaptel task command [command options] [arguments...]
create There are two ways to create a task.
1) Use a task manifest with [--task-manifest, t]
2) Provide a workflow manifest and schedule details [--workflow-manifest, -w]
--task-manifest value, -t value File path for task manifest to use for task creation.
--workflow-manifest value, -w value File path for workflow manifest to use for task creation
--interval value, -i value Interval for the task schedule [ex (simple schedule): 250ms, 1s, 30m (cron schedule): "0 * * * * *"]
--start-date value Start date for the task schedule [defaults to today]
--start-time value Start time for the task schedule [defaults to now]
--stop-date value Stop date for the task schedule [defaults to today]
--stop-time value Start time for the task schedule [defaults to now]
--name value, -n value Optional requirement for giving task names
--duration value, -d value The amount of time to run the task [appends to start or creates a start time before a stop]
--no-start Do not start task on creation [normally started on creation]
--deadline value The deadline for the task to be killed after started if the task runs too long (All tasks default to 5s)
--max-failures value The number of consecutive failures before Snap disables the task
* Note: Start and stop date/time are optional.
list list
start start <task_id>
stop stop <task_id>
remove remove <task_id>
export export <task_id>
watch watch <task_id>
enable enable <task_id>
help, h Shows a list of commands or help for one command
$ snaptel plugin command [command options] [arguments...]
load load <plugin_path>
unload unload <plugin_type> <plugin_name> <plugin_version>
swap swap <load_plugin_path> <unload_plugin_type>:<unload_plugin_name>:<unload_plugin_version> or swap <load_plugin_path> -t <unload_plugin_type> -n <unload_plugin_name> -v <unload_plugin_version>
list list
help, h Shows a list of commands or help for one command
$ snaptel metric command [command options] [arguments...]
list list
get get details on a single metric
help, h Shows a list of commands or help for one command
In one terminal window, run snapteld (log level is set to 1 and signing is turned off for this example):
$ snapteld --log-level 1 --log-path '' --plugin-trust 0
prepare a task manifest file, for example, task.json with following content:
{
"version": 1,
"schedule": {
"type": "simple",
"interval": "1s"
},
"max-failures": 10,
"workflow": {
"collect": {
"metrics": {
"/intel/mock/foo": {},
"/intel/mock/bar": {},
"/intel/mock/*/baz": {}
},
"config": {
"/intel/mock": {
"name": "root",
"password": "secret"
}
},
"process": [
{
"plugin_name": "passthru",
"process": null,
"publish": [
{
"plugin_name": "mock-file",
"config": {
"file": "/tmp/snap_published_mock_file.log"
}
}
]
}
]
}
}
}
prepare a workflow manifest file, for example, workflow.json with the following content:
{
"collect": {
"metrics": {
"/intel/mock/foo": {}
},
"config": {
"/intel/mock/foo": {
"password": "testval"
}
},
"process": [],
"publish": [
{
"plugin_name": "mock-file",
"config": {
"file": "/tmp/rest.test"
}
}
]
}
}
and then:
- load a collector plugin
- load a processing plugin
- load a publishing plugin
- list the plugins
- start a task with a task manifest
- start a task with a workflow manifest
- list the tasks
- unload the plugins
$ snaptel plugin load /opt/snap/plugins/snap-plugin-collector-mock1
$ snaptel plugin load /opt/snap/plugins/snap-plugin-processor-passthru
$ snaptel plugin load /opt/snap/plugins/snap-plugin-publisher-mock-file
$ snaptel plugin list
$ snaptel task create -t mock-file.json
$ snaptel task create -w workflow.json -i 1s -d 10s
$ snaptel task list
$ snaptel plugin unload collector mock <version>
$ snaptel plugin unload processor passthru <version>
$ snaptel plugin unload publisher publisher <version>