Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

Commit

Permalink
(SDI-2199) snaptel/snapteld documentation changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nanliu committed Nov 21, 2016
1 parent d1c48a8 commit fc2219a
Show file tree
Hide file tree
Showing 32 changed files with 183 additions and 188 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ test-all:
# By default compiles will use all cpu cores, use BUILD_JOBS to control number
# of parallel builds: `BUILD_JOBS=2 make plugins`
#
# Build only snapd/snapctl
# Build only snapteld/snaptel
snap:
bash -c "./scripts/build_snap.sh"
# Build only plugins
Expand Down
47 changes: 21 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The key features of Snap are:

Some additionally important notes about how Snap works:

* Multiple management modules including: [CLI](docs/SNAPCTL.md) (snapctl) and [REST API](docs/REST_API.md) (each of which can be turned on or off)
* Multiple management modules including: [CLI](docs/SNAPTEL.md) (snaptel) and [REST API](docs/REST_API.md) (each of which can be turned on or off)
* Secure validation occurs via plugin signing, SSL encryption for APIs and payload encryption for communication between components
* CLI control from Linux or MacOS

Expand Down Expand Up @@ -121,24 +121,20 @@ Tarball (choose the appropriate version and platform):
```
$ curl -sfLO https://github.com/intelsdi-x/snap/releases/download/0.18.0/snap-0.18.0-linux-amd64.tar.gz
$ tar xf snap-0.18.0-linux-amd64.tar.gz
$ cp snapd /usr/local/bin
$ cp snapctl /usr/local/bin
$ cp snapteld /usr/local/sbin
$ cp snaptel /usr/local/bin
```

Ubuntu 16.04.1 [snapd package version 2.13+](https://launchpad.net/ubuntu/+source/snapd) installs snapd/snapctl binary in /usr/bin. These executables are not related to snap-telemetry. Running `snapctl` from snapd package will result in the following error message:
NOTE: snap-telemetry packages prior to 0.19.0 installed `/usr/local/bin/{snapctl|snapd}` and these binaries have been renamed to `snaptel` and `snapteld`. snap-telemetry packages prior to 0.18.0 symlinked `/usr/bin/{snapctl|snapd}` to `/opt/snap/bin/{snapctl|snapd}` and may cause conflicts with [Ubuntu's `snapd` package](http://packages.ubuntu.com/xenial-updates/snapd). Ubuntu 16.04.1 [snapteld package version 2.13+](https://launchpad.net/ubuntu/+source/snapd) installs snapd/snapctl binary in /usr/bin. These executables are not related to snap-telemetry. Running `snapctl` from snapd package will result in the following error message:

```
$ snapctl
error: snapctl requires SNAP_CONTEXT environment variable
```

If you installed snap-telemetry package, please make sure `/usr/local/bin` is part of your $PATH and has higher priority than `/usr/bin`, or invoke the snap-telemetry snapd/snapctl binary using fully qualified path.

NOTE: snap-telemetry packages prior to 0.18.0 symlinked `/usr/bin/{snapctl|snapd}` to `/opt/snap/bin/{snapctl|snapd}` and may cause conflicts with [Ubuntu's `snapd` package](http://packages.ubuntu.com/xenial-updates/snapd).

NOTE: If you prefer to build from source, follow the steps in the [build documentation](docs/BUILD_AND_TEST.md). The _alpha_ binaries containing the latest master branch are available here for bleeding edge testing purposes:
* snapd: [linux](http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snapd) | [darwin](http://snap.ci.snap-telemetry.io/snap/latest_build/darwin/x86_64/snapd)
* snapctl: [linux](http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snapctl) | [darwin](http://snap.ci.snap-telemetry.io/snap/latest_build/darwin/x86_64/snapctl)
* snapteld: [linux](http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snapteld) | [darwin](http://snap.ci.snap-telemetry.io/snap/latest_build/darwin/x86_64/snapteld)
* snaptel: [linux](http://snap.ci.snap-telemetry.io/snap/latest_build/linux/x86_64/snaptel) | [darwin](http://snap.ci.snap-telemetry.io/snap/latest_build/darwin/x86_64/snaptel)

### Running Snap

Expand All @@ -157,16 +153,15 @@ $ systemctl start snap-telemetry
If you installed Snap from binary, you can start Snap daemon via the command:
```
$ sudo mkdir -p /var/log/snap
$ sudo snapd --plugin-trust 0 --log-level 1 -o /var/log/snap &
$ sudo snapteld --plugin-trust 0 --log-level 1 --log-path /var/log/snap &
```

To view the service logs:
```
$ tail -f /var/log/snap/snapd.log
$ tail -f /var/log/snap/snapteld.log
```

By default, Snap daemon will be running in standalone mode and listening on port 8181. To enable gossip mode, checkout the [tribe documentation](docs/TRIBE.md). For additional configuration options such as plugin signing and port configuration see [snapd documentation](docs/SNAPD.md).

By default, Snap daemon will be running in standalone mode and listening on port 8181. To enable gossip mode, checkout the [tribe documentation](docs/TRIBE.md). For additional configuration options such as plugin signing and port configuration see [snapteld documentation](docs/SNAPTELD.md).

### Load Plugins

Expand All @@ -181,17 +176,17 @@ $ curl -sfL "https://github.com/intelsdi-x/snap-plugin-publisher-file/releases/d
$ curl -sfL "https://github.com/intelsdi-x/snap-plugin-collector-psutil/releases/download/8/snap-plugin-collector-psutil_${OS}_${ARCH}" -o snap-plugin-collector-psutil
```

Next load the plugins into Snap daemon using `snapctl`:
Next load the plugins into Snap daemon using `snaptel`:
```
$ snapctl plugin load snap-plugin-publisher-file
$ snaptel plugin load snap-plugin-publisher-file
Plugin loaded
Name: file
Version: 2
Type: publisher
Signed: false
Loaded Time: Fri, 14 Oct 2016 10:53:59 PDT
$ snapctl plugin load snap-plugin-collector-psutil
$ snaptel plugin load snap-plugin-collector-psutil
Plugin loaded
Name: psutil
Version: 8
Expand All @@ -202,15 +197,15 @@ Loaded Time: Fri, 14 Oct 2016 10:54:07 PDT

Verify plugins are loaded:
```
$ snapctl plugin list
$ snaptel plugin list
NAME VERSION TYPE SIGNED STATUS LOADED TIME
file 2 publisher false loaded Fri, 14 Oct 2016 10:55:20 PDT
psutil 8 collector false loaded Fri, 14 Oct 2016 10:55:29 PDT
```

See which metrics are available:
```
$ snapctl metric list
$ snaptel metric list
NAMESPACE VERSIONS
/intel/psutil/cpu/cpu-total/guest 8
/intel/psutil/cpu/cpu-total/guest_nice 8
Expand Down Expand Up @@ -238,7 +233,7 @@ To collect data, you need to create a task by loading a `Task Manifest`. The Tas
Now, download and load the [psutil example](examples/tasks/psutil-file.yaml):
```
$ curl https://raw.githubusercontent.com/intelsdi-x/snap/master/examples/tasks/psutil-file.yaml -o /tmp/psutil-file.yaml
$ snapctl task create -t /tmp/psutil-file.yaml
$ snaptel task create -t /tmp/psutil-file.yaml
Using task manifest to create task
Task created
ID: 8b9babad-b3bc-4a16-9e06-1f35664a7679
Expand All @@ -253,9 +248,9 @@ This starts a task collecting metrics via psutil, then publishes the data to a f
$ tail -f /tmp/psutil_metrics.log
```

Or directly tap into the data stream that Snap is collecting using `snapctl task watch <task_id>`:
Or directly tap into the data stream that Snap is collecting using `snaptel task watch <task_id>`:
```
$ snapctl task watch 8b9babad-b3bc-4a16-9e06-1f35664a7679
$ snaptel task watch 8b9babad-b3bc-4a16-9e06-1f35664a7679
NAMESPACE DATA TIMESTAMP
/intel/psutil/cpu/cpu-total/idle 451176.5 2016-10-14 11:01:44.666137773 -0700 PDT
/intel/psutil/cpu/cpu-total/system 33749.2734375 2016-10-14 11:01:44.666139698 -0700 PDT
Expand All @@ -269,7 +264,7 @@ Nice work - you're all done with this example. Depending on how you started `sna

* init.d service: `service snap-telemetry stop`
* systemd service: `systemctl stop snap-telemetry`
* ran `snapd` manually: `sudo pkill snapd`
* ran `snapteld` manually: `sudo pkill snapteld`

When you're ready to move on, walk through other uses of Snap available in the [Examples folder](examples/).

Expand All @@ -284,9 +279,9 @@ If you would like to write your own, read through [Author a Plugin](#author-a-pl
## Documentation
Documentation for Snap will be kept in this repository for now with an emphasis of filling out the `docs/` directory. We would also like to link to external how-to blog posts as people write them. [Read about contributing to the project](#contributing) for more details.

* [snapd (Snap agent)](docs/SNAPD.md)
* [configuring snapd](docs/SNAPD_CONFIGURATION.md)
* [snapctl (Snap CLI)](docs/SNAPCTL.md)
* [snapteld (Snap agent)](docs/SNAPTELD.md)
* [configuring snapteld](docs/SNAPTELD_CONFIGURATION.md)
* [snaptel (Snap CLI)](docs/SNAPTEL.md)
* [build and test](docs/BUILD_AND_TEST.md)
* [REST API](docs/REST_API.md)
* [tasks](docs/TASKS.md)
Expand Down
4 changes: 2 additions & 2 deletions cmd/snaptel/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func beforeAction(ctx *cli.Context) error {
}

// Checks if a tribe command was issued when tribe mode was not
// enabled on the specified snapd instance.
// enabled on the specified snapteld instance.
func checkTribeCommand(ctx *cli.Context) error {
tribe := false
for _, a := range os.Args {
Expand All @@ -114,7 +114,7 @@ func checkTribeCommand(ctx *cli.Context) error {
if resp.Err.Error() == "Invalid credentials" {
return resp.Err
}
return fmt.Errorf("Tribe mode must be enabled in snapd to use tribe command")
return fmt.Errorf("Tribe mode must be enabled in snapteld to use tribe command")
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion control/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ const (
`
)

// get the default snapd configuration
// get the default snapteld configuration
func GetDefaultConfig() *Config {
return &Config{
ListenAddr: defaultListenAddr,
Expand Down
2 changes: 1 addition & 1 deletion control/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
const (
MOCK_CONSTRAINTS = `{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "snapd global config schema",
"title": "snapteld global config schema",
"type": ["object", "null"],
"properties": {
"control": { "$ref": "#/definitions/control" },
Expand Down
2 changes: 1 addition & 1 deletion control/plugin/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func (e *ExecutablePlugin) Run(timeout time.Duration) (Response, error) {
for stdOutScanner.Scan() {
// The first chunk from the scanner is the plugin's response to the
// handshake. Once we've received that, we can begin to forward
// logs on to snapd's log.
// logs on to snapteld's log.
if !respReceived {
respBytes := stdOutScanner.Bytes()
err = json.Unmarshal(respBytes, &resp)
Expand Down
2 changes: 1 addition & 1 deletion control/strategy/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ type pool struct {

// The plugins in the pool.
// the primary key is an increasing --> uint from
// snapd epoch (`service snapd start`).
// snapteld epoch (`service snapteld start`).
plugins MapAvailablePlugin
pidCounter uint32

Expand Down
8 changes: 4 additions & 4 deletions docs/BUILD_AND_TEST.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ By default `make` runs `make deps`, `make snap`, and `make plugins` commands for

* `deps`: fetches all dependencies using glide
* `test-(legacy|small|medium|large)`: runs test suite
* `all`: builds snapd, snapctl, and test plugins for all platforms (MacOS and Linux)
* `snap` builds snapd and snapctl for local operating system
* `all`: builds snapteld, snaptel, and test plugins for all platforms (MacOS and Linux)
* `snap` builds snapteld and snaptel for local operating system
* `plugins` builds test plugins for local operating system
* `install`: installs snapd and snapctl binaries in /usr/local/bin
* `install`: installs snapteld and snaptel binaries in /usr/local/bin

To see how to use Snap, look at [getting started](../README.md#getting-started), [SNAPD.md](SNAPD.md), and [SNAPCTL.md](SNAPCTL.md).
To see how to use Snap, look at [getting started](../README.md#getting-started), [SNAPTELD.md](SNAPTELD.md), and [SNAPTEL.md](SNAPTEL.md).

## Test
### Creating Tests
Expand Down
2 changes: 1 addition & 1 deletion docs/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A metric in Snap has the following fields.
* The framework currently adds the following standard tag to all metrics
* `plugin_running_on` describing on which host the plugin is running. This value is updated every hour due to a TTL set internally.
* May be added by a task manifests as described [here](https://github.com/intelsdi-x/snap/pull/941)
* May be added by the snapd config as described [here](https://github.com/intelsdi-x/snap/issues/827)
* May be added by the snapteld config as described [here](https://github.com/intelsdi-x/snap/issues/827)
* Unit `string`
* Describes the magnitude being measured
* Can be an empty string for unitless data
Expand Down
14 changes: 7 additions & 7 deletions docs/PLUGIN_LIFECYCLE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ limitations under the License.
A Snap plugin can be in a `Loaded` or `Running` state. A plugin can be loaded
in the following two ways.

1. `snapd` was started with an auto discover path `snapd -a /etc/snapd/plugins`
2. A user loads a plugin through the REST API or using the snapctl
1. `snapteld` was started with an auto discover path `snapteld -a /opt/snap/plugins`
2. A user loads a plugin through the REST API or using the snaptel
* `curl -F file=@snap-plugin-publisher-file http://localhost:9191/v1/plugins`
* `snapctl plugin load snap-plugin-publisher-file`
* `snaptel plugin load snap-plugin-publisher-file`

A plugin transitions to a `running` state when a task is started that uses the
plugin. This is also called a plugin subscription.

## What happens when a plugin is loaded

When a plugin is loaded snapd takes the following steps.
When a plugin is loaded snapteld takes the following steps.

1. Handshakes with the plugin by reading it's stdout
2. Updates the metric catalog by calling the plugin over RPC
Expand All @@ -44,7 +44,7 @@ as soon as the metric catalog has been updated.

## What happens when a plugin is unloaded

When a plugin is unloaded snapd removes it from the metric catalog and running
When a plugin is unloaded snapteld removes it from the metric catalog and running
instances of the plugin are stopped.

## What happens when a task is started
Expand All @@ -53,12 +53,12 @@ When a task is started the plugins that the task references are started and
subscribed to. The following steps are taken when a task is created and
started.

1. On **task creation** the task is validated (`snapctl task create -t mytask.yml
1. On **task creation** the task is validated (`snaptel task create -t mytask.yml
--no-start`)
* The schedule is validated
* The config provided for the metrics (collectors), processors and
publishers are validated
2. On **task starting** the plugins are started (`snapctl task start <TASK_ID>`)
2. On **task starting** the plugins are started (`snaptel task start <TASK_ID>`)
3. Subscriptions for each plugin referenced by the task are incremented

## Diving deeper
Expand Down
2 changes: 1 addition & 1 deletion docs/PLUGIN_PACKAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Image) format defined in the
plugin.

When Snap loads a plugin it detects the plugins type. If the plugin is a binary
the plugin is run by snapd which handshakes with the plugin via reading its
the plugin is run by snapteld which handshakes with the plugin via reading its
standard output. If the plugin is packaged as an ACI image it is extracted
and Snap executes the program referenced by the `exec` field.

Expand Down
Loading

0 comments on commit fc2219a

Please sign in to comment.