Skip to content

Repository files navigation

Mechanical Drill

Description

Mechanical Drill is a tool to enable a hardware aware Nomad cluster by discovering hardware equipment connected to a machine. This equipment information is exposed as node metadata which can be used for a more dynamic scheduling using placement constraints.

Node Metadata with Mechanical Drill hardware information

Node Metadata with Mechanical Drill hardware information image

Installation

wget https://github.com/cloudputation/mechanical-drill/releases/download/${RELEASE}/mechanical-drill -O ./drill
chmod +x ./drill
mv ./drill /usr/bin/

Configuration

By default, Mechanical Drill looks for a configuration file at path: /etc/mechanical-drill/config.hcl

Here is an example drill config file

// Those configuration options are reserved for a future version
log_dir     = "log"
data_dir    = "drill-data"
listen      = "5177"
nomad_host  = "127.0.0.1"
//

drill {
  system {
    enabled   = true
    frequency = 60
  }
  network {
    enabled   = true
    frequency = 60
  }
  cpu {
    enabled   = true
    frequency = 60
  }
  battery {
    enabled   = true
    frequency = 30
  }
}

you can find fully configured config.hcl here

Complete hardware classes avalaible

System
Battery
Bridge
Memory
Processor
Address
Storage
Disk
Tape
Bus
Network
Display
Input
Printer
Multimedia
Communication
Power
Volume
Generic

Usage

Just run the executable as is:

drill

Classification

Devices are added to a list as they are collected. The first occurrence is 0 meaning it will be labeled as device0. For example: if you want to schedule a job based on the percentage of the first battery of your system then md.battery.device0.percentage will be the correct constraint to use in your Nomad job.

Schedule jobs to manage a fleet of drones based on battery level

Fly to recharge pad:

constraint {
  attribute = "${meta.md.battery.device0.percentage}"
  operator  = "<"
  value     = "30"
}

Return to work:

constraint {
  attribute = "${meta.md.battery.device0.state}"
  value     = "fully-charged"
}

Compatibility

For now Mechanical Drill is only compatible with Linux systems

Specifications

Although the classes battery and power are similar, they are different in their purpose:

battery returns the battery status and charge percentage. Possible statuses are "charging", "discharging" or "fully-charged".

power returns hardware specific information such as the manufacturer

Contributing

Feel free to create an issue or propose a pull request. Follow the Code of Conduct.

About

Machine hardware and peripheral reconnaissance tool for Hashicorp Nomad

Resources

Code of conduct

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages