Autodiscovery

SAYMON allows to describe the infrastructure of any complexity in terms of objects and links between them. Then this infrastructure is filled with information, received from monitoring agents, widgets with current metrics and graphs, painted in the colors of the states.

However, creating an infrastructure map manually is often too tiring, because it can contain thousands of objects. To solve this problem, SAYMON provides mechanisms for objects autodetection. With their help, most of the objects of interest to the user can be added to the infrastructure map automatically, without manual “clicking” in the web interface.

There are two types of object autodiscovery in SAYMON.

The first ones are built-in mechanisms that work without any efforts from the user. These include, for example, the network autodiscovery mechanism, which displays in the diagram all the hosts available in the local network.

The second type is the methods in the REST API that can be used by user automation scripts to create objects in SAYMON. Using such scripts, any autodetection algorithm for any kind of infrastructure objects can be implemented.

Built-in autodiscovery

The built-in autodiscovery mechanisms are implemented inside SAYMON and work automatically when the system is started (unless they are disabled by the administrator).

SAYMON’s built-in autodiscovery mechanisms include network autodiscovery.

Network autodiscovery

The agent scans the subnetwork and sends to the server information about all IP addresses available for a TCP connection or available via PING. For discovered hosts, objects of the Host class with corresponding addresses are created in SAYMON and displayed on the infrastructure map. Every created object includes the subobject of the Ping class and the Ping sensor (performed by the agent, which has discovered the host).

Discovered object’s IP address is automatically added to the IP property. It can be used to get access to the host over SSH, Telnet or web interface using the context menu.

image

Network autodiscovery is enabled by default and can be disabled in the agent configuration file, using the parameter agent.discoveryEnabled:

agent.discoveryEnabled=false

By default the discovered objects are created in the root object of the hierarchy. In order to change the parent object it is necessary to specify the desired parent object’s identifier in the server.discovery_parent_id parameter of the server configuration file:

...
"server" : {
 ...
    "discovery_parent_id" : "632aae8b1a687b43378c0657",
    ...
},
...
For each of the discovered hosts only one object is created. After removing the discovered object it is added to the 'stop list' and won’t be re-added.

Agent autoregistration

If you install an agent on the host and set agent.id to 0, the server automatically creates an object of the Host class.

The created object has:

  • a name created with the following template – hostname (ip address of the host).

  • Hostname and IP properties:

    image
  • the following child objects with the default probes:

    image
To automatically update the name and properties of the created object, set the server configuration variable server.hostname_update.enabled to true.

Autodiscovery via API

SAYMON REST API allows users to implement any suitable mechanism of objects autodiscovery using an automatic script. REST API works over HTTP, so the script can be implemented in any language or platform with an HTTP client.

The simplest example is a bash script that sends http-requests to SAYMON via curl.

Adding objects via REST

For example, there can be a script that detects a certain type of objects in the infrastructure (network devices or services). The detected objects can be added to SAYMON with the POST /node/api/objects REST method:

# Code for objects discovery
...

# Add discovered object to SAYMON.
$curl -v http://saymon.local/node/api/objects \
  -u "admin:saymon" \
  -H "Content-Type: application/json" \
  -X POST \
  -d '{"name": "Discovered object", "discovery_id": "Object_identifier"}'
More information about object creation and examples for other programming languages - https://api.saymon.tech/documentation/methods/objects/create-new-object.html

Discovery_id in the example above is a string that unequivocally identifies the object in the infrastructure and prevents its duplication in SAYMON.

If there is the object with the specified discovery_id in SAYMON, the existing object is modified with new data (a new object will not be created). This allows to run the autodiscovery script for example on a schedule and be sure that the previously detected objects will not be created again in SAYMON.

In case of network devices, discovery_id can be the device’s IP or MAC address.