How to Set a Device Threshold and Trigger Event Notify?

For devices monitoring, DeviceOn provides the rule engine. Users can acquire anomaly situations by means of setting thresholds to those interested devices, and, once one or more thresholds meets, receive alerts via event notification services, another one indispensable feature for users. This lab guides you how to set thresholds to a device and how to set event notification services as well. As such, after this lab, you should:

  • Learn how to set thresholds to a device on demand.
  • Learn how to set event notification services, including email, LINE, and WeChat as well.

Prerequisite

  • A running DeviceOn server.
  • A device that installed WISE-Agent connects to DeviceOn server.
  • A valid, send-able, email account to enable Email notification service.
  • A valid LINE account to enable LINE notification service.
  • A valid WeChat account, as well as a valid GitHub account, to enable WeChat notification service.

Steps to Set Email Service

The configuration of using email as one of event notification services is a system-wide setting. This means DeviceOn uses the server, the one you set in this step, to send all emails. Therefore, uses email settings from your organization is recommended, rather than uses your personal Gmail. If you really want to use Gmail, the situations you are running into may vary and depends on your google account settings. So, in this lab, we assume that you have already a valid business email address from your company.

Step 1: Click “Setting” menu on the left-hand side of DeviceOn portal and then, “Notification”. Click “EMail” bar to open settings regarding email notification service.

Step 2: Toggle “On/Off” switch to enable this feature. Then fill fields up with proper values. And end up this step by clicking “Test” button.

  • EMAIL SERVER: The email server host name.
  • PORT: The email server port. Normally this is 25.
  • SSL/TLS: Toggle to a proper setting.
  • EMAIL ACCOUNT: Your email account name. If takes the windows domain into account, a value format like “DOMAIN\USER” should be used.
  • EMAIL PASSWORD: Your password to sign in to the email server.
  • SENDER EMAIL: Your email address.
  • EMAIL SUBJECT: Leave it the default.

Step 3: To assert all values are correct, click “Test” button, on the bottom right of the page, to open the “Send Email for Testing” dialog for testing purpose. And fill a recipient email as well as email body. Then click “Test” on this dialog. An email you should receive in a while later. Revise them until you got a test email.

Step 4: Click “Save” on the bottom right of the page that shows in step 2 to keep all settings and enable email notification service.

Steps to Set LINE Service

Step 1: Go to https://notify-bot.line.me/ and sign in with your LINE account. Click “My Page” from your account’s dropdown menu in the upper right of the page.

Step 2: Click “Generate token” under “Generate access token (For developers)”. It pops up the “Generate token” dialog.

Step 3: Fill token field up with “DeviceOn” and click the “1-on-1 chat with LINE Notify” item. Then click the “Generate token” button in green at bottom.

Step 4: A new window pops up with token. Meanwhile, a LINE message about this token generation received immediately. Click “Copy” to keep the token in memory, or any file you like.

Step 5: Now switch your browser to DeviceOn portal. Click “Setting” menu on the left-hand side, then “Notification”, and last “LINE” bar to open settings regarding LINE event notification service.

Step 6: Toggle “On/Off” switch to enable this feature. Click “Test” to show the test dialog up.

Step 7: Paste the copied token into the first field (LINE Token) and write something into the second field (LINE Message Content). Click “Test”, you should receive the messages you wrote with “DeviceOn” as the prefix.

Step 8: Click “Save” button that shows in Step 6 to keep your settings and enable LINE event notification service.

Steps to WeChat Service

Step 1: Go to http://sc.ftqq.com/3.version. Click “登入网站” hyperlink.

Step 2: Sign in with your GitHub account.

Step 3: Click “微信推送” hyperlink.

Step 4: Click “开始绑定”. It opens a QR code image.

Step 5: Take your mobile up, swipe and open WeChat App to scan this generated QR code so that the service can bind with your WeChat account.

Step 6: Once it is done. The page changes, like below.

Step 7: Click “SCKEY” hyperlink and copy, from the opened page, the SCKEY value.

Step 8: Now switch your browser to DeviceOn portal. Click “Setting” menu on the left-hand side, then “Notification”, and “WeChat” to open settings regarding WeChat event notification service.

Step 9: Toggle “On/Off” switch to enable this feature. Click “Test” to show the test dialog up. Paste the copied SCKEY, copied in step 7, into the first field “WECHAT SC KEY”. Give a title to the second field “WECHAT MESSAGE TITLE”. Write some message content to the last field “WECHAT MESSAGE CONTENT”. And click “Test” to see if it works or not.

Step 10: Click “Save” button that shows in step 9 to keep your settings and enable WeChat event notification service.

Steps to Set Telegram Service

Step 1: Search “BotFather” and start to chat on your Telegram App.

Step 2: Create a new bot and generate an authorization token.
Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authorization token for your new bot. The name of your bot is displayed in contact details and elsewhere.

The Username is a short name, to be used in mentions and t.me links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot's username must end in 'bot', e.g. 'tetris_bot' or 'TetrisBot'.

The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot.

Step 2: Create your private channel on Telegram

Step 3: Invite your bot into the channel.

Step 4: Set your bot as “Administrators

Step 5: Enter any txt message in the channel.

Step 6: Retrieve the chat id via below URL with your authorization token (Step 2).

https://api.telegram.org/botTOKEN/getUpdates

The response that include your chat id as below example.

Step 7: Now switch your browser to DeviceOn portal. Click “Setting” menu on the left-hand side, then “Notification”, and “Telegram” to open settings regarding Telegram event notification service.

Step 8: Toggle “On/Off” switch to enable this feature. Click “Test” to show the test dialog up. Paste the copied Token and chat id, copied in step 2 and step 6. Give a title to the second field “Telegram Message Content”. Write some message content to the last field “Test”. And click “Test” to see if it works or not.

Step 9: Click “Save” button that shows in step 8 to keep your settings and enable Telegram event notification service.

Steps to Set Microsoft Teams Service

Step 1: In the function menu of the channel where you want to send the message, select(Other), and select the connector in the menu.

Step 2: Select “Incoming Webhook

Step 3: Give this connector a name, then press the create button.

Step 4: At this time, a set of URLs will appear, which are used to transfer message. After copying, press the “Done” button.

Step 5: Now switch your browser to DeviceOn portal. Click “Setting” menu on the left-hand side, then “Notification”, and “Microsoft Teams” to open settings regarding Teams event notification service.

Step 6: Toggle “On/Off” switch to enable this feature. Click “Test” to show the test dialog up. Paste the URL, copied in step 4. Give a title to the second field “Microsoft Teams Message Content”. Write some message content to the last field “Test”. And click “Test” to see if it works or not.

Step 7: Click “Save” button that shows in step 6 to keep your settings and enable Microsoft Teams event notification service.

Steps to Set Slack Service

Step 1: Create your channel on your Slack.

Step 2: Give this channel name and set as private.

Step 3: Skip or add your member into channel.

Step 4: After logging in to slack, there will be a row of menus on the right, click "Apps" to expand the sub-menu, and then click "Add Apps"

Step 5: A search box will appear, type "webhooks" and you will see the first result is "Incoming WebHooks", then click to install and “Add to Slack”.

Step 6: Click "Add to Slack", and a menu will appear asking which channel to install on. After selecting it, click "Incoming WebHooks integration".

Step 7: After installation, you will enter the setting page of incoming webhooks. The first line of the page "Webhook URL" is the most important. We can send out automatic notification messages as long as we post to this url.

Step 8: Now switch your browser to DeviceOn portal. Click “Setting” menu on the left-hand side, then “Notification”, and “Slack” to open settings regarding Slack event notification service.

Step 9: Toggle “On/Off” switch to enable this feature. Click “Test” to show the test dialog up. Paste the URL, copied in step 4. Give a title to the second field “Slack Message Content”. Write some message content to the last field “Test”. And click “Test” to see if it works or not.

Steps to Set Thresholds to a Device

Step 1: Click “Device” menu on the left-hand side of DeviceOn portal and, then, “Rule Engine”, click the plus (+) sign to enter “Rule Engine” page.

Step 2: Choose each setting with a proper value within step 1 – Select Sensor.

  • SELECT RULE TYPE: Shows the new rule engine applies to a single device or a device group. Please pick “Device” here.
  • SELECT DEVICE GROUP: Also, leave it the default, “Default”.
  • SELECT DEVICE: Which device the new rule engine will apply? We choose “AA-Win” in this lab environment.
  • KEYWORD SEARCH: Please enter “hard drive” so that only hard drive relevant items available.
    Here, to ease this lab, we pick “Hard Drive Free Space” as a threshold of the rule engine. In addition, like the picture shows, it illustrates the disk C is the target hard drive in this lab. Click “Next” to go to next step.

Step 3: Now we need to define a threshold for this rule engine in this step. Based on “Current Value” shows on top right, check the “Less than” radio button and slide to a maximum value that just on less than “Current Value”.
Leave “Lasting Time” as well as “Notice Interval” the defaults. “Lasting Time” indicates that the target device runs into the abnormal condition only when it reaches the set threshold and last the set time. While “Notice Interval” tells the interval of users receive an event, until the condition back to normal. Then click “Next” to go to next page.

Step 4: We are now in “Define Action” step. Pick “Power On/Off” from “TAKE A ACTION”, “System Restart” from “TAKE A SUB ACTION”, and “Back to Normal” for “Trigger Frequency”. These combination means that the target device will reboot once it backs to normal, after it enters the threshold we set. Also, click “Next” to go to next page.

Step 5: Review all information within this page. Leave “Enable” the default and click “Confirm” button to set this rule, and apply it to the target device as well.

Step 6: The new item should be populated as the image shows.

Step 7: Click “Device” menu item on left hand side of DeviceOn portal. You can see a green circle represents the target device accordingly.

Step 8: We can do something so that the target device meets the threshold we set previous. Here we download the newest Ubuntu ISO image to the target device. The green circle shows in step 7 changes, a while later, to an orange one, of which indicates it runs into an abnormal condition.

Step 9: Interrupt the download action at any time or wait until it finishes. Purge the downloaded file so that the target device has free space more than the threshold we set previous. After a while, the target device should reboot due to the rule engine we set. Note here that it may be necessary to purge the recycle bin to achieve our goal.

Step 10: Pick-up a notification item (Threshold Category) and make sure your account alert service be enabled.

Select a repo