Almond Monitor API:s

Both Almond and HowRU have json API:s, but they are working differently.

HowRU have a get only API that is easy to use and that does not require authentication. HowRU also have a proxy functionality, meaning that the results of API calls can be provided from multiple Almond servers.

Almond on the other hand does not have any such proxy functionality, but will only return data from the unit where it is installed.
However, Almond API have a richer feature set enabling you not only to retrieve data but also to execute plugins, enable and disable features in the running process and change variables such as to which topic Almond should write data (if using Kafka) - without needing to restart the application.

Below you will have a list of the calls you can make to the API:s.

HowRU API

The following API calls are currently available with the HowRU API:

API callDescription
/api/statusShort compilation of server state.
/api/summarySame as above.
/api/howruSame as above.
/api/howareyouSame as above.
/howru/api/howareyouSame as above.
/howru/monitoring/howareyouSame as above.
/api/criticalsCompilation of all plugins in critical state.
/howru/api/criticalsSame as above.
/howru/monitoring/criticalsCompilation of all plugins in critical state.
/api/warningsCompilation of all plugins in warning state.
/howru/api/warningsSame as above.
/howru/monitoring/warningsCompilation of all plugins in warning state.
/api/okCompilation of all plugins in state ok.
/api/oksSame as above.
/howru/api/okSame as above.
/howru/monitoring/okCompilation of all plugins in state ok.
/api/changesCompilation of changes
/howru/api/changesSame as above
/howru/monitoring/changesCompilation of changes
/api/showallAll plugin results are shown
/api/allSame as above
/api/jsonSame as above
/howeu/api/showallSame as above
/howru/api/allSame as above
/howru/api/jsonSame as above
/howru/monitoring/jsonAll plugin results are shown
/api/serversResults from specifik server in multimode. id or name must be provided.
/howru/api/serversSame as above
/api/aliasShow results from alias as provided in the aliases.conf file.
/api/search?name=searchstringSearch results from string
/api/querysearch?name=searchstringSame as above
/howru/api/search?name=searchstringSame as above
/api/query?id=plugin_idSearch result of a specific plugin id
/api/plugin?id=plugin_idSame as above
/howru/api/plugin?id=plugin_idSame as above
/api/plugin?index=plugin_indexResult of specific plugin by index_name
/howru/monitoring/plugin?id=plugin_idResult of a specific plugin by id
/howru/monitoring/plugin?name=plugin_nameResult of specific plugin by plugin name
/howru/settings/pluginsShow settings of plugins running on the server
/howru/settings/schedulerShow all settings in the almond.conf file

Note All of the API calls can take the parameter whichjson if you want the API to look only in a particular json-file if you are running in multiserver (proxy)-mode.

In multiserver-mode the parameter server can also be used if you want to look at the result from a particular server of many:

curl url_to_hostserver:port/api/howareyou

will return status information from all servers running under the api.

curl url_to_hostserver:port/api/howareyou&server=testserver.test.domain.com

will only show status from the particular server testserver.test.domain.com.

Apart from the above API calls HowRU also have a number of calls mainly to be used with integration scripts, which are listed here:

API callDescription
/api/countjobsReturns the number of plugins handled by HowRu.
/howru/api/countjobsSame as above.
/api/countserversReturns the number of servers HowRU is serving.
/howru/api/countserversSame as above.
/api/elderpluginrunReturns a timestamp of the "oldest" plugin execution.
/howru/api/elderpluginrunSame as above.
/api/getmaintenanceReturns a list of all plugins that are disabled.
/howru/api/getmaintenanceSame as above.
/api/getmaintenancelistReturns a list of the maintenance status of all plugin items.
/howru/api/getmaintenancelistSame as above.
/api/lastpluginrunReturns a timestamp of when the last plugin was executed.
/howru/api/lastpluginrunSame as above.
/api/listjobnamesReturns a list with the names of all plugins handled by this HowRU instance.
/howru/api/listjobnamesSame as above.
/api/listjobsReturns the name and id of all plugins handled by this HowRU installation.
/howru/api/listjobsSame as above.
/api/listserversReturns the list of all servers handled by this HowRU instance.
/howru/api/listserversSame as above
/api/unixdeploytimeReturns the unix timestamp of when the configuration file was last changed.
/howru/api/unixdeplytimeSame as above
/api/unixupdatetimeReturns a unix timestamp for when plugin configuration was last changed..
/howru/api/serversSame as above

Almond API

The Almond service has its own API, which should be used with more caution than the more easygoing HowRU API. The Almond API, if enabled, is running on the port specified in the
file almond.conf. As a user the HowRU API should generally be preferred to be used in all cases where it provides the same service as the Almond API.

Almond API will require you to send a valid json object which it can evalutate, as will be explained further later. An API call to Almond could look like this:

curl localhost:9909 -d '{"action":"set","name":"hostname","value":"newservername","token":"qwyhb67jnds1qee9x"}'

With Almond API you have the possibility to change some variables that was written in configuration files, read plugin results, run and toggle processes inside Almond as well as executing plugins,
including sending arbitary parameters to them. While Almond API provide a great opportunity to make integrations with other systems and optimize the Almond process,
but is more complex to use compared to the API provided by HowRU.

Note! All calls to Almond API that involves executing code or change values within the program require you to use a token ackknowledged by Almond.
You find an almond_token_generator in the directory /opt/almond/utilities that will help you create and install tokens.

All calls to Almond API must have the "action" parameter specified, as well as following parameters depending on what you want to achieve.
A list of valid actions are specified below.

Allowed actions in Almond API

Using Almond API actions

Depending of action a number of other parameters are required, where name is usually always required and then depending on the action further parameters such as flags, value and args must be added. The token parameter must be added for all API calls that trigger changes or runs.

You can however run a read command such as the one below without supplementing a token:

curl localhost:9909 -d '{"action":"read", "name":"check_memory", "flags":"verbose"}'

You can also retrieve metrics without a token:

curl localhost:9909 -d '{"action":"metrics", "name":"getmetrics"}'

As a final more complex example, this call would trigger a plugin to execute a dry run with the arguments passed by the API call:

curl localhost:9909 -d '{"action":"execute", "name":"check_memory", "flags":"dry", "args":"-w 70 -c 75", "token":"qwyhb67jnds1qee9x"}'

You can look at the API section in the Almond Admin page after installing the Almond package, to see what types of calls are possible and try them out from there.