Skip to content
Silly CLI for querying clusto more quickly
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
clusto_query
contrib/bin
test
.gitignore
LICENSE.txt
README.md
requirements-test.txt
requirements.txt
setup.cfg
setup.py

README.md

clusto-query performs arbitrary boolean queries against clusto. It is available under the ISC license, which you can find under LICENSE.txt and requires the python clusto libraries.

Infix expression operators are the following:

Operator Aliases Meaning
= is equality
!= isnt, <> inequality
<= le less than or equal to
< lt less than
>= ge greater than or equal to
> gt greater than
^ startswith string starts with
, endswith string ends with
contains string contains
in_cidr IP address is in CIDR range

Additionally, there are boolean operators and, or, and - (set subtraction)

some keywords (pool, datacenter, clusto_type, and name) can be directly queried anything that's an "Attribute" must be prefixed with attr

Here's an example query:

clusto_type = server and
(attr system.cpucount >= 15 or system.memory >= 32760)
and datacenter = peak-mpl1'

This query fetches all servers with more than 16 cores or 32768 MB of RAM located in the "peak-mlp1" datacenter. Neato!

Note that I put in "15" instead of "16" intentionally; clusto's cpu counting is off-by-one. That was fun. Let's go again:

clusto_type contains "server" and
(attr nagios.disabled = 1 - hostname endswith peak2)

This one finds all servers that are disabled in nagios and do not have a hostname that ends in peak2.

Quoting and parens work the way you expect them to.

Run tests with nosetests -w clusto_query --with-coverage

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.