6.24. Passive Hardware Discovery

Switch type nodes can be discovered either by running a discovery graph against them or creating via http calls with the autoDiscover field set to true.

6.24.1. Automatic Discovery

A new node created by posting to /api/current/node will be automatially discovered if:

  • the type is ‘switch’
  • it has an snmpSettings field with the host to query and snmp community string
  • the autoDiscover field is set to true

Create a Node to be Auto-Discovered

POST /api/current/nodes
{
    "name": "nodeName"
    "type": "switch",
    "autoDiscover": true
    "snmpSettings": {
        host: "10.1.1.3",
        community: "public"
    }
}
curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"name":"nodeName", "type": "switch", "autoDiscover":true, \
     "snmpSettings": {"host": "10.1.1.3", "community": "public"}}' \
    <server>/api/current/nodes
{
    "type":"switch",
    "name":"nodeName",
    "autoDiscover":true,
    "snmpSettings":{
        "host":"10.1.1.3",
        "community":"HZTvBPqhg4ccDop5mfyziw==.wIeqRE9y0s0/o5cDWa4OLw==",
        "nodeId":"55b6aac1024fd1b349afc145"
    },
    "createdAt":"2015-07-27T22:03:45.353Z",
    "updatedAt":"2015-07-27T22:03:45.353Z",
    "id":"55b6aac1024fd1b349afc145"
}

6.24.2. Discover an existing device node

If you want to discover a switch node manually either create the node without an autoDiscover option or set autoDiscover to false you can then run discovery against the node by posting to /api/current/nodes/:identifier/workflows and specifying the node id in the graph options, eg:

POST /api/current/nodes/55b6afba024fd1b349afc148/workflows
{
    "name": "Graph.Switch.Discovery",
    "options": {
        "defaults": {
            "nodeId": "55b6afba024fd1b349afc148"
        }
    }
}
curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"name": "Graph.Switch.Discovery", \
     "options":{"defaults":{"nodeId": "55b6afba024fd1b349afc148"}}}' \
    <server>/api/current/nodes/55b6afba024fd1b349afc148/workflows

You can also use this mechanism to discovery a compute server or PDU, simply using different settings. For example, a smart PDU:

curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"name":"nodeName", "type": "pdu", \
     "snmpSettings": {"host": "10.1.1.3", "community": "public"}}' \
    <server>/api/current/nodes
curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"name": "Graph.PDU.Discovery", \
     "options":{"defaults":{"nodeId": "55b6afba024fd1b349afc148"}}}' \
    <server>/api/1.1/nodes/55b6afba024fd1b349afc148/workflows

And a management server (or other server you do not want to or cannot to reboot to interrogate)

curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"name":"nodeName", "type": "compute", \
    "obms": [ { "service": "ipmi-obm-service", "config": { "host": "10.1.1.3",  \
    "user": "admin", "password": "admin" } } ] }' \
    <server>/api/current/nodes
curl -X POST \
    -H 'Content-Type: application/json' \
    -d '{"name": "Graph.MgmtSKU.Discovery",
     "options":{"defaults":{"nodeId": "55b6afba024fd1b349afc148"}}}' \
    <server>/api/current/nodes/55b6afba024fd1b349afc148/workflows