Environmental device management system built for hundreds of entities, thousands environments, and millions of devices.
Environmental inventory(device) management system built for hundreds of entities, thousands environments, and millions of devices.
The following guide will result in a running cruton application.
Requirements:
docker-compose build
docker-compose up
This setup creates a basic cassandra container with no authentication needed. So we don’t need to create a user with a password. We do howerver need to createa keyspace.
docker exec -ti cassandra_cruton cqlsh localhost -e "CREATE KEYSPACE IF NOT EXISTS "cruton" WITH REPLICATION = {'class': 'NetworkTopologyStrategy', 'datacenter1': 1};"
docker exec -ti cruton_cruton_1 cruton-manage --config-file /etc/cruton/cruton.ini sync_tables
To start the API it’s recommended that you run the service behind a webserver like NGINX, Apache, using uWSGI, etc.
The typical API process can be envoked by running the cruton-api-wsgi --config-file /etc/cruton/cruton.ini
command.
If you need or want to run the API in debug mode you can do so by invoking the cruton-api-debug --config-file /etc/cruton/cruton.ini
command.
curl 'http://127.0.0.1:5150/dicovery'
The API endpoints and all available actions are discoverable. The dicovery endpoint allows the a user or an
application to discover all available actions for all available versions.
curl --head 'http://127.0.0.1:5150/v1/entities'
curl -H 'Content-Type: application/json' -D - -XPUT 'http://127.0.0.1:5150/v1/entities/Solo1' -d '{"name": "TestEntitySolo"}'
curl --head 'http://127.0.0.1:5150/v1/entities/Solo1'
curl -H 'Content-Type: application/json' -D - -XPOST 'http://127.0.0.1:5150/v1/entities' -d '[{"ent_id": "Ent1", "tags": ["TestEntityTagOne"], "contacts": {"person1": "4155551212", "person2": "[email protected]"}, "name": "TestEntityOne"}, {"ent_id": "Ent2", "tags": ["TestEntityTagOne", "TestEntityTagTwo"], "contacts": {"person2": "[email protected]"}, "name": "TestEntityTwo"}]'
curl 'http://127.0.0.1:5150/v1/entities'
curl -D - 'http://127.0.0.1:5150/v1/entities?contact=person1'
curl -D - 'http://127.0.0.1:5150/v1/entities?name=EntityTag&fuzzy=true'
You should be aware that ANY field in the data module can be part of the search criteria.
# HEAD environments root
curl --head 'http://127.0.0.1:5150/v1/entities/Ent1/environments'
curl -H 'Content-Type: application/json' -D - -XPUT 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1' -d '{"name": "SoloEnvironmentOne"}'
# HEAD environments root
curl --head 'http://127.0.0.1:5150/v1/entities/Ent1/environments/SoloEnv1'
curl -H 'Content-Type: application/json' -D - -XPOST 'http://127.0.0.1:5150/v1/entities/Ent1/environments' -d '[{"env_id": "Env1", "tags": ["TestEnvironmentTagOne"], "contacts": {"person1": "4155551212", "person2": "[email protected]"}, "name": "TestEnvironmentOne"}, {"env_id": "Env2", "tags": ["TestEnvironmentTagOne", "TestEnvironmentTagTwo"], "contacts": {"person1": "4155551212"}, "name": "TestEnvironmentTwo"}]'
curl -D - 'http://127.0.0.1:5150/v1/entities/x/environments/Env2'
curl -D - 'http://127.0.0.1:5150/v1/entities/x/environments?contact=person1'
curl -D - 'http://127.0.0.1:5150/v1/entities/x/environments?tag=EnvironmentTag&fuzzy=true'
You should be aware that ANY field in the data module can be part of the search criteria.
curl --head http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices
curl -H 'Content-Type: application/json' -D - -XPUT 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices/SoloDev1' -d '{"name": "SoloDeviceOne"}'
curl --head http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices/SoloDev1
curl -H 'Content-Type: application/json' -D - -XPOST 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices' -d '[{"dev_id": "Dev1", "tags": ["TestEnvironmentTagOne"], "access_ip": {"drac": "172.16.24.1", "mgmt": "fe80::6656:fc1d:cd1:ddba"}, "rack_id": "TestRack1", "row_id": "TestRow1", "name": "TestDeviceOne"}, {"dev_id": "Dev2", "tags": ["TestDeviceTagOne", "TestDeviceTagTwo"], "access_ip": {"drac": "172.16.24.2", "mgmt": "fe80::6656:fc1d:cd1:ddbb"}, "rack_id": "TestRack2", "row_id": "TestRow1", "name": "TestDeviceTwo"}]'
curl 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices'
curl 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices?row_id=TestRow1'
curl 'http://127.0.0.1:5150/v1/entities/Solo1/environments/SoloEnv1/devices?name=Test&fuzzy=true'
You should be aware that ANY field in the data module can be part of the search criteria.
curl 'http://127.0.0.1:5150/v1/entities/TestEntity1/environments/TestEnvironment1A/devices/TestDevice1A/ipxe"
If a device has an has variable with “ipxe_” as the prefix the ipxe endpoint will return an ipxe config using those variables.
Automated data population can be simply done using an Ansible playbook. More on helpful playbooks can be found here
cruton-manage --config-file /etc/cruton/cruton.ini sync_tables
Additional documentation: