The lmcadm command line utility strives to provide an admin and script friendly interface to select LMC functionality.
Install via rubygems:
$ gem install lmcadm
Building native extensions for certain dependencies require ruby headers or source code to be present. These can usually be installed the same way ruby was installed.
On Ubuntu for example, installing the ruby-dev
via the package manager is sufficient.
Lmcadm works with https://rubyinstaller.org/downloads/, use the recommended version with Devkit and choose the default options during install. Installation can continue with rubygems.
Installing lmcadm fails with ERROR: Failed to build gem native extension.
Ruby headers and some tools to build software (C compiler, make) are needed.
On Ubuntu for example, the packages ruby-dev
and build-essential
should be enough.
apt install ruby-dev build-essential
Unable to load the EventMachine C extension ; To use the pure-ruby reactor, require 'em/pure_ruby'
Workaround: Reinstall eventmachine with --platform ruby.
gem uninstall eventmachine (select all versions if prompted)
gem install eventmachine --platform ruby
The primary usage documentation is in the help output of lmcadm:
$ lmcadm help
After checking out the repo, run bin/setup
to install dependencies. Then, run rake test
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Set the environment variable LMCADM_PATH_DEP to 1 to use the lmc gem from ../ruby-lmc. Example: $ LMCADM_PATH_DEP=1 bundle exec lmcadm --version
- Apply workaround reinstalling eventmachine (see above)
- run ocra.sh
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/lmcadm. The sentence above is patently wrong currently.
The gem is available as open source under the terms of the BSD 3-Clause License.
Example use:
lmcadm monitor -A "ExampleProject" raw device_info cloud_rtt 42adf60b-0fe7-4187-af4f-9ee97669bfb0
When specifying a period longer than MINUTE1, the name must be suffixed with a dot, followed by an aggregation type. Available types are
- .min
- .max
- .avg
Example use:
$ lmcadm monitor -A "ExampleProject" raw --type scalar --period MINUTE10 \
device_info cloud_rtt.max 3e19ada7-86fa-4809-a14e-7174b018603d
This dumps the raw values response as json.
To further extract data, use something that can parse json, like jq
[1].
Example use:
$lmcadm monitor -A "ExampleProject" raw --type json --period MINUTE1 \
wan_info_json interfaces a6871a81-84f3-4c57-a20e-c3410b47e895 | jq ' .[]["DSL-CH-1"].rxRate'
Prints table data as one row per sample. Empty row handling is shaky, as is error handling in general.
$ lmcadm monitor -A "ExampleProject" raw --type table device_info \
device 3a096938-87b4-47c8-a388-fda75f30eacc
CLOUD_RTT | CPU_LOAD | UPTIME | TOTAL_MEMORY | FREE_MEMORY | CONTROL_RX | CONTROL_TX | MONITORING_RX | MONITORING_TX
----------|----------|----------|--------------|-------------|------------|------------|---------------|--------------
29 | 1 | 19512712 | 248064 | 27228 | 513704725 | 291602474 | 119108008 | 936963871
29 | 0 | 19512652 | 248064 | 27228 | 513701635 | 291600722 | 119107296 | 936957306
30 | 1 | 19512592 | 248064 | 27228 | 513698545 | 291598970 | 119106584 | 936950729
77 | 6 | 19512533 | 248064 | 27228 | 513695455 | 291597218 | 119105872 | 936944149
...