About

monit is an opensource service status monitoring tool that can be coupled with a centralized daemon such as m/monit in order to display an overview for all services monitored via monit.

This tutorial presents a software project that combines monit, m/monit, OpenHab2 and Amazon Alexa in order to announce any service status changes. In other words, whilst monitoring daemons on a large server farm, Alexa will be able to announce service status changes.

For example, given a server with the hostname set to yolo, when a daemon goes down, Alexa will say "yolo: 5 services out of 6 are running and 1 service is down." When the service recovers, Alexa will say "yolo: All 6 services are running".

Requirements

  • OpenHAB2 with custom built AlexaTTS or the Amazon Echo Control Binding. This tutorial assumes that most of the AlexaTTS has been setup and that you are able to make Alexa talk via MQTT.
  • monit, with the proper service files set up and monitoring services.
  • m/monit installed and connected with one or more monit daemons.
  • Node.JS at least version 11.

Download

The project can be retrieved from the following Subversion repository:

for instance, by issuing the command:

svn co http://svn.grimore.org/alexa-monit/trunk alexa-monit

OpenHAB2

Although this tutorial does not cover making Alexa talk via OpenHAB2, with the amazoechocontrol binding installed, an item file can be created at /etc/openhab2/items/MQTTSay.items with the following contents:

/*************************************************************************/
/*                               MQTTSay                                 */
/*************************************************************************/

Group MQTTSay "MQTTSay" <power>

String MQTTSay_String (MQTTSay) { mqtt="<[mosquitto:alexa/say:state:default]" }

String EchoTTS "Text to Speech" (MQTTSay) {channel="amazonechocontrol:echo:alexaAccount:echo:textToSpeech"}

in order to allow messages sent on the topic alexa/say to be spoken by Alexa.

In order to test, one would issue the following command:

mosquitto_pub -h MQTT_SERVER -t 'alexa/say' -m 'Test'

where:

  • MQTT_SERVER is the hostname or IP address of the MQTT server,

in order to make Alexa say Test.

Using the Software

Checkout the repository to, say /srv on Linux:

cd /srv
svn co http://svn.grimore.org/alexa-monit/trunk alexa-monit

Next, install the node modules required by changing directory to, say, /srv/alexa-monit/node_modules and issue the command:

npm install

Finally, copy config.yml.dist to config.yml and edit the configuration file config.yml to set the polling interval (by default $60000ms$), the URL to the mmonit web interface including the username and password used to access the interface as well as the MQTT server URL and the topic depending on the item file created in the previous step.

Once set up, the software can be run by issuing the command:

node main.js

at which point alexa-monit will start monitoring mmonit and push any status changes to the MQTT server that will be picked up by OpenHAB2 and pushed to Alexa to be spoken.

Testing

On any machine monitored by monit, stop a service using monit stop and Alexa should announce the change.


iot/openhab2/announcing_mmonit_service_status_changes_via_alexa_using_openhab2.txt ยท Last modified: 2022/04/19 08:28 by 127.0.0.1

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.