With the recent addition of the relations to the VM layer in the gridscale support for libretto, it’s now a matter of a few lines of code to check for certain criteria. See this blogpost on some notes on relations.

Before we dive into the examples: gridscale-check lives at g.hazardous.org.

Checking the amount of assigned memory

%> ./gridscale-check servers status -t server.memory  -u 3e63d1792231-49c9-34a1-ac32-9197de37 -m 4
OK - Expected amount (4 <= 4) of memory assigned: 4

Or if you want to check wether the assigned memory is within certain boundaries

%> ./gridscale-check servers status -t server.memory  -u 3e63d1792231-49c9-34a1-ac32-9197de37 -m 4 -n 6
OK - Expected amount (4 <= 4 <= 6) of memory assigned: 4

Checking the amount of assigned cpu cores

The same goes for the cpu cores, in this example the instance has 2 cores assigned, but we check that at least 4 are assigned:

%> ./gridscale-check servers status -t server.cores  -u 3e63d1792231-49c9-34a1-ac32-9197de37 -m 4 -n 6
CRITICAL - Expect amount (4 <= 2 <= 6) of cores NOT assigned: 2

Firewall state and IPs assigned

As previously mentioned, I wanted to be able to check wether an instance has a certain firewall template enabled:

%> ./gridscale-check servers status -t firewall.template -u 3e63d1792231-49c9-34a1-ac32-9197de37 -r 3d8458f2-4cad-b73d-75f1-1c88b66c470c
OK - Expected firewall template '3d8458f2-75f1-4cad-b73d-1c88b66c470c' is active

This makes use of the relation that is mapped within the gridscale api.

One can also check wether a certain public ip has been assigned to this instance:

%> ./gridscale-check servers status -t ip.assigned -u 3e63d1792231-49c9-34a1-ac32-9197de37 -c
OK - Expected ip '' is assigned

The check for the ip works either by passing an IP to compare against (-c) or via a relation (-r) where the ObjectUUID of the related object is being passed.

Monitor all the things!