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

Commit

Permalink
Merge pull request #27 from andrzej-k/ak_doc_snaptel
Browse files Browse the repository at this point in the history
Updated snapd/snapctl to snapteld/snaptel
  • Loading branch information
kindermoumoute authored Nov 22, 2016
2 parents 0af3ab0 + 06a13a5 commit 6d7fe7b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 22 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Snap plugin intended to process data and return statistics over a sliding window
### Installation
#### Download plugin binary:

You can get the pre-built binaries for your OS and architecture from the plugin's [GitHub Releases](https://github.com/intelsdi-x/snap-plugin-processor-statistics/releases) page. Download the plugin from the latest release and load it into `snapd` (`/opt/snap/plugins` is the default location for Snap packages).
You can get the pre-built binaries for your OS and architecture from the plugin's [GitHub Releases](https://github.com/intelsdi-x/snap-plugin-processor-statistics/releases) page. Download the plugin from the latest release and load it into `snapteld` (`/opt/snap/plugins` is the default location for Snap packages).

#### To build the plugin binary:
Fork https://github.com/intelsdi-x/snap-plugin-processor-statistics
Expand Down Expand Up @@ -63,7 +63,7 @@ Documentation for Snap collector psutil plugin can be found [here](https://githu

In one terminal window, open the Snap daemon :
```
$ snapd -t 0 -l 1
$ snapteld -t 0 -l 1
```
The option "-l 1" it is for setting the debugging log level and "-t 0" is for disabling plugin signing.

Expand All @@ -75,14 +75,14 @@ $ wget http://snap.ci.snap-telemetry.io/plugins/snap-plugin-collector-psutil/lat
$ wget http://snap.ci.snap-telemetry.io/plugins/snap-plugin-processor-statistics/latest/linux/x86_64/snap-plugin-processor-statistics
$ wget http://snap.ci.snap-telemetry.io/plugins/snap-plugin-publisher-file/latest/linux/x86_64/snap-plugin-publisher-file
$ chmod 755 snap-plugin-*
$ snapctl plugin load snap-plugin-collector-psutil
$ snapctl plugin load snap-plugin-publisher-file
$ snapctl plugin load snap-plugin-processor-statistics
$ snaptel plugin load snap-plugin-collector-psutil
$ snaptel plugin load snap-plugin-publisher-file
$ snaptel plugin load snap-plugin-processor-statistics
```

See available metrics for your system
```
$ snapctl metric list
$ snaptel metric list
```

Create a task file. For example, sample-psutil-statistics-task.json:
Expand Down Expand Up @@ -130,24 +130,24 @@ Creating a task manifest file.

Start task:
```
$ snapctl task create -t sample-psutil-statistics-task.json
$ snaptel task create -t sample-psutil-statistics-task.json
Using task manifest to create task
Task created
ID: 02dd7ff4-8106-47e9-8b86-70067cd0a850
Name: Task-02dd7ff4-8106-47e9-8b86-70067cd0a850
State: Running
```

See realtime output from `snapctl task watch <task_id>` (CTRL+C to exit)
See realtime output from `snaptel task watch <task_id>` (CTRL+C to exit)
```
snapctl task watch 02dd7ff4-8106-47e9-8b86-70067cd0a850
snaptel task watch 02dd7ff4-8106-47e9-8b86-70067cd0a850
```

This data is published to a file `/tmp/published` per task specification

Stop task:
```
$ snapctl task stop 02dd7ff4-8106-47e9-8b86-70067cd0a850
$ snaptel task stop 02dd7ff4-8106-47e9-8b86-70067cd0a850
Task stopped:
ID: 02dd7ff4-8106-47e9-8b86-70067cd0a850
```
Expand Down
24 changes: 12 additions & 12 deletions scripts/spec/task_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

describe docker_build(template: SnapUtils.examples/"Dockerfile.erb", log_level: :info) do
describe docker_run(described_image, :env => {'SNAP_VERSION'=>ENV['SNAP_VERSION']}, :wait => 10) do
describe file("/opt/snap/bin/snapd"), :retry => 3, :retry_wait => 5 do
describe file("/usr/local/sbin/snapteld"), :retry => 3, :retry_wait => 5 do
it { should be_file }
it { should be_executable }
end

describe file("/opt/snap/bin/snapctl") do
describe file("/usr/local/bin/snaptel") do
it { should be_file }
it { should be_executable }
end

describe command("snapd --version") do
describe command("snapteld --version") do
its(:exit_status) { should eq 0 }
its(:stdout) { should contain /#{ENV['SNAP_VERSION']}/ }
end if ENV['SNAP_VERSION'] =~ /^\d+.\d+.\d+$/

# NOTE: using ip instead of localhost due a known issue with alpine:
# https://github.com/gliderlabs/docker-alpine/issues/8
snapctl = "snapctl -u 'http://127.0.0.1:8181'"
snaptel = "snaptel -u 'http://127.0.0.1:8181'"

describe "snapctl plugin list", :retry => 3, :retry_wait => 10 do
describe "snaptel plugin list", :retry => 3, :retry_wait => 10 do

it {
cmd=cmd_with_retry("#{snapctl} plugin list")
cmd=cmd_with_retry("#{snaptel} plugin list")
expect(cmd.exit_status).to eq 0
expect(cmd.stdout).to contain /psutil/
expect(cmd.stdout).to contain /file/
Expand All @@ -36,7 +36,7 @@
context "Snap task #{t}" do
task_id = nil

describe command("#{snapctl} task create -t /opt/snap/tasks/#{t}") do
describe command("#{snaptel} task create -t /opt/snap/tasks/#{t}") do
its(:exit_status) { should eq 0 }
its(:stdout) { should contain /Task created/ }
it {
Expand All @@ -46,11 +46,11 @@
}
end

describe "snapctl task list" do
describe "snaptel task list" do
it {
# NOTE: The sleep here is to ensure the plugin isn't disabled
sleep 15
cmd=command("#{snapctl} task list")
cmd=command("#{snaptel} task list")
expect(cmd.exit_status).to eq 0
expect(cmd.stdout).to contain /Running/
}
Expand All @@ -76,20 +76,20 @@
# NOTE: can not use the normal describe command(...) since we need to access task_id
describe "Stop task" do
it {
c = command("#{snapctl} task stop #{task_id}")
c = command("#{snaptel} task stop #{task_id}")
expect(c.exit_status).to eq 0
expect(c.stdout).to match /Task stopped/
}
end

describe "Remove task" do
it {
c = command("#{snapctl} task remove #{task_id}")
c = command("#{snaptel} task remove #{task_id}")
expect(c.exit_status).to eq 0
expect(c.stdout).to match /Task removed/
}
end
end
end
end
end
end

0 comments on commit 6d7fe7b

Please sign in to comment.