We are starting to use slack https://slack.com/ to create channels for each alerting system to keep track all in one place.
It would be great if hostmon had the ability to plug straight into the Slack API so we don't have to rely on a system such as email which has no guaranteed delivery reliability.
cheers.
Additional Alert options
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
You may use "Execure external program" action with the folowing JScript.
Just save script into slack.js, add new "Execute external program" action with the following parameters:
Command line: cmd /c cscript D:\SCRIPTS\slack.js TestName=%TestName% Status=%Status% Reply=%Reply% Recurrences=%Recurrences%
Window mode: WS_HIDE
Please note, url value (Line 4 of this script) should be replaced by your "Webhook URL"
How to get your "Webhook URL":
1. Sign in to Slack
2. Create channel for HostMonitor alerts (e.g. #HostMonitor)
3. Click on your username (top left corner) -> Apps & Custom Integrations
4. Click on "Build your own" button (top right corner)
5. Click on "Make a Custom integration" (Something just for my team)
6. Select Incomming WebHooks
7. Post to Channel: select #HostMonitor
8. Click on "Add incomming WebHooks integration"
9. Copy your "Webhook URL" and paste it to Line 4 of slack.js
10. Review incomming WebHooks settings and click "Save Settings"
Code: Select all
objArgs = WScript.Arguments;
var http = new ActiveXObject("MSXML2.ServerXMLHTTP");
http.setOption(2,13056);
var url = "https://hooks.slack.com/services/T0JSK6152/B0JSBEQG5/mr4w8zwBnfwLrtxvpyHJKL";
var alertmsg = "";
for (i = 0; i < objArgs.length; i++)
{
alertmsg+=objArgs(i)+' ';
}
http.open("POST", url, false);
http.setRequestHeader("Content-type", "application/json");
try {
data = '{"text":"'+alertmsg+'"}';
http.send(data);
} catch(e) {
throw new Error(e.message);
WScript.Quit;
}
var resp = http.responseText;
WScript.StdOut.Write(resp);
Command line: cmd /c cscript D:\SCRIPTS\slack.js TestName=%TestName% Status=%Status% Reply=%Reply% Recurrences=%Recurrences%
Window mode: WS_HIDE
Please note, url value (Line 4 of this script) should be replaced by your "Webhook URL"
How to get your "Webhook URL":
1. Sign in to Slack
2. Create channel for HostMonitor alerts (e.g. #HostMonitor)
3. Click on your username (top left corner) -> Apps & Custom Integrations
4. Click on "Build your own" button (top right corner)
5. Click on "Make a Custom integration" (Something just for my team)
6. Select Incomming WebHooks
7. Post to Channel: select #HostMonitor
8. Click on "Add incomming WebHooks integration"
9. Copy your "Webhook URL" and paste it to Line 4 of slack.js
10. Review incomming WebHooks settings and click "Save Settings"
Depends on your HostMonitor version.
If its not too old (like 10.00) then you may use HTTP Request action
https://www.ks-soft.net/hostmon.eng/mfr ... tm#actHTTP
Regards
Alex
If its not too old (like 10.00) then you may use HTTP Request action
https://www.ks-soft.net/hostmon.eng/mfr ... tm#actHTTP
Regards
Alex