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

Commit cd9c1a8

Browse files
authored
Merge pull request #1357 from nanliu/SDI-2199
(SDI-2199) Fix #1344 binary change to snaptel/snapteld
2 parents f827263 + fc2219a commit cd9c1a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+227
-231
lines changed

Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ test-all:
4343
# By default compiles will use all cpu cores, use BUILD_JOBS to control number
4444
# of parallel builds: `BUILD_JOBS=2 make plugins`
4545
#
46-
# Build only snapd/snapctl
46+
# Build only snapteld/snaptel
4747
snap:
4848
bash -c "./scripts/build_snap.sh"
4949
# Build only plugins
@@ -53,7 +53,7 @@ plugins:
5353
all:
5454
bash -c "./scripts/build_all.sh"
5555
install:
56-
cp build/$(OS)/$(ARCH)/snapd /usr/local/bin/
57-
cp build/$(OS)/$(ARCH)/snapctl /usr/local/bin/
56+
cp build/$(OS)/$(ARCH)/snapteld /usr/local/sbin/
57+
cp build/$(OS)/$(ARCH)/snaptel /usr/local/bin/
5858
proto:
5959
cd `echo $(GOPATH) | cut -d: -f 1`; bash -c "./src/github.com/intelsdi-x/snap/scripts/gen-proto.sh"

README.md

+21-26
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ The key features of Snap are:
7575

7676
Some additionally important notes about how Snap works:
7777

78-
* 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)
78+
* 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)
7979
* Secure validation occurs via plugin signing, SSL encryption for APIs and payload encryption for communication between components
8080
* CLI control from Linux or MacOS
8181

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

128-
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:
128+
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:
129129

130130
```
131131
$ snapctl
132132
error: snapctl requires SNAP_CONTEXT environment variable
133133
```
134134

135-
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.
136-
137-
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).
138-
139135
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:
140-
* 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)
141-
* 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)
136+
* 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)
137+
* 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)
142138

143139
### Running Snap
144140

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

163159
To view the service logs:
164160
```
165-
$ tail -f /var/log/snap/snapd.log
161+
$ tail -f /var/log/snap/snapteld.log
166162
```
167163

168-
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).
169-
164+
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).
170165

171166
### Load Plugins
172167

@@ -181,17 +176,17 @@ $ curl -sfL "https://github.com/intelsdi-x/snap-plugin-publisher-file/releases/d
181176
$ 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
182177
```
183178

184-
Next load the plugins into Snap daemon using `snapctl`:
179+
Next load the plugins into Snap daemon using `snaptel`:
185180
```
186-
$ snapctl plugin load snap-plugin-publisher-file
181+
$ snaptel plugin load snap-plugin-publisher-file
187182
Plugin loaded
188183
Name: file
189184
Version: 2
190185
Type: publisher
191186
Signed: false
192187
Loaded Time: Fri, 14 Oct 2016 10:53:59 PDT
193188
194-
$ snapctl plugin load snap-plugin-collector-psutil
189+
$ snaptel plugin load snap-plugin-collector-psutil
195190
Plugin loaded
196191
Name: psutil
197192
Version: 8
@@ -202,15 +197,15 @@ Loaded Time: Fri, 14 Oct 2016 10:54:07 PDT
202197

203198
Verify plugins are loaded:
204199
```
205-
$ snapctl plugin list
200+
$ snaptel plugin list
206201
NAME VERSION TYPE SIGNED STATUS LOADED TIME
207202
file 2 publisher false loaded Fri, 14 Oct 2016 10:55:20 PDT
208203
psutil 8 collector false loaded Fri, 14 Oct 2016 10:55:29 PDT
209204
```
210205

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

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

270265
* init.d service: `service snap-telemetry stop`
271266
* systemd service: `systemctl stop snap-telemetry`
272-
* ran `snapd` manually: `sudo pkill snapd`
267+
* ran `snapteld` manually: `sudo pkill snapteld`
273268

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

@@ -284,9 +279,9 @@ If you would like to write your own, read through [Author a Plugin](#author-a-pl
284279
## Documentation
285280
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.
286281

287-
* [snapd (Snap agent)](docs/SNAPD.md)
288-
* [configuring snapd](docs/SNAPD_CONFIGURATION.md)
289-
* [snapctl (Snap CLI)](docs/SNAPCTL.md)
282+
* [snapteld (Snap agent)](docs/SNAPTELD.md)
283+
* [configuring snapteld](docs/SNAPTELD_CONFIGURATION.md)
284+
* [snaptel (Snap CLI)](docs/SNAPTEL.md)
290285
* [build and test](docs/BUILD_AND_TEST.md)
291286
* [REST API](docs/REST_API.md)
292287
* [tasks](docs/TASKS.md)
File renamed without changes.
File renamed without changes.
File renamed without changes.

cmd/snapctl/main.go cmd/snaptel/main.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ func newUsageError(s string, ctx *cli.Context) usageError {
5858

5959
func main() {
6060
app := cli.NewApp()
61-
app.Name = "snapctl"
61+
app.Name = "snaptel"
6262
app.Version = gitversion
6363
app.Usage = "The open telemetry framework"
6464
app.Flags = []cli.Flag{flURL, flSecure, flAPIVer, flPassword, flConfig}
@@ -92,7 +92,7 @@ func beforeAction(ctx *cli.Context) error {
9292
}
9393

9494
// Checks if a tribe command was issued when tribe mode was not
95-
// enabled on the specified snapd instance.
95+
// enabled on the specified snapteld instance.
9696
func checkTribeCommand(ctx *cli.Context) error {
9797
tribe := false
9898
for _, a := range os.Args {
@@ -114,7 +114,7 @@ func checkTribeCommand(ctx *cli.Context) error {
114114
if resp.Err.Error() == "Invalid credentials" {
115115
return resp.Err
116116
}
117-
return fmt.Errorf("Tribe mode must be enabled in snapd to use tribe command")
117+
return fmt.Errorf("Tribe mode must be enabled in snapteld to use tribe command")
118118
}
119119
return nil
120120
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

control/config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ const (
131131
`
132132
)
133133

134-
// get the default snapd configuration
134+
// get the default snapteld configuration
135135
func GetDefaultConfig() *Config {
136136
return &Config{
137137
ListenAddr: defaultListenAddr,

control/config_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ import (
3535
const (
3636
MOCK_CONSTRAINTS = `{
3737
"$schema": "http://json-schema.org/draft-04/schema#",
38-
"title": "snapd global config schema",
38+
"title": "snapteld global config schema",
3939
"type": ["object", "null"],
4040
"properties": {
4141
"control": { "$ref": "#/definitions/control" },

control/plugin/execution.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func (e *ExecutablePlugin) Run(timeout time.Duration) (Response, error) {
123123
for stdOutScanner.Scan() {
124124
// The first chunk from the scanner is the plugin's response to the
125125
// handshake. Once we've received that, we can begin to forward
126-
// logs on to snapd's log.
126+
// logs on to snapteld's log.
127127
if !respReceived {
128128
respBytes := stdOutScanner.Bytes()
129129
err = json.Unmarshal(respBytes, &resp)

control/strategy/pool.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ type pool struct {
106106

107107
// The plugins in the pool.
108108
// the primary key is an increasing --> uint from
109-
// snapd epoch (`service snapd start`).
109+
// snapteld epoch (`service snapteld start`).
110110
plugins MapAvailablePlugin
111111
pidCounter uint32
112112

docs/BUILD_AND_TEST.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ By default `make` runs `make deps`, `make snap`, and `make plugins` commands for
5050

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

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

6060
## Test
6161
### Creating Tests

docs/METRICS.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ A metric in Snap has the following fields.
2222
* The framework currently adds the following standard tag to all metrics
2323
* `plugin_running_on` describing on which host the plugin is running. This value is updated every hour due to a TTL set internally.
2424
* May be added by a task manifests as described [here](https://github.com/intelsdi-x/snap/pull/941)
25-
* May be added by the snapd config as described [here](https://github.com/intelsdi-x/snap/issues/827)
25+
* May be added by the snapteld config as described [here](https://github.com/intelsdi-x/snap/issues/827)
2626
* Unit `string`
2727
* Describes the magnitude being measured
2828
* Can be an empty string for unitless data

docs/PLUGIN_LIFECYCLE.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ limitations under the License.
2121
A Snap plugin can be in a `Loaded` or `Running` state. A plugin can be loaded
2222
in the following two ways.
2323

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

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

3232
## What happens when a plugin is loaded
3333

34-
When a plugin is loaded snapd takes the following steps.
34+
When a plugin is loaded snapteld takes the following steps.
3535

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

4545
## What happens when a plugin is unloaded
4646

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

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

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

6464
## Diving deeper

docs/PLUGIN_PACKAGING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Image) format defined in the
66
plugin.
77

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

0 commit comments

Comments
 (0)