Initial addition of Slack Webhook Notifications for Health Check notifications

This commit is contained in:
Jeavon Leopold
2017-06-05 10:15:26 +02:00
parent 643dab0238
commit 48864e3fa4
5 changed files with 34 additions and 1 deletions
+9
View File
@@ -203,6 +203,15 @@
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=104.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.104.4.0\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text, Version=3.9.71.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.3.9.71\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="Slack.Webhooks, Version=0.1.7.18980, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Slack.Webhooks.0.1.7\lib\net40\Slack.Webhooks.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
+3
View File
@@ -33,7 +33,10 @@
<package id="MySql.Data" version="6.9.9" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="RestSharp" version="104.4.0" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.71" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="Slack.Webhooks" version="0.1.7" targetFramework="net45" />
<package id="SqlServerCE" version="4.0.0.1" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.36" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.21" targetFramework="net45" />
@@ -3,6 +3,7 @@ using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Slack.Webhooks;
using Umbraco.Core;
using Umbraco.Core.Configuration.HealthChecks;
using Umbraco.Core.Logging;
@@ -68,7 +69,15 @@ namespace Umbraco.Web.Scheduling
// TODO: get web hook and post
if (!string.IsNullOrEmpty(healthCheckConfig.NotificationSettings.WebhookUrl))
{
var slackClient = new SlackClient(healthCheckConfig.NotificationSettings.WebhookUrl);
var slackMessage = new SlackMessage
{
Channel = "#test",
Text = sb.ToString(),
IconEmoji = Emoji.Ghost,
Username = "Umbraco Health Check Notifier"
};
slackClient.Post(slackMessage);
}
LogHelper.Info<HealthCheckNotifier>("Health check results:");
+9
View File
@@ -184,9 +184,18 @@
<HintPath>..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp, Version=104.4.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.104.4.0\lib\net4\RestSharp.dll</HintPath>
</Reference>
<Reference Include="Semver, Version=1.1.2.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\semver.1.1.2\lib\net45\Semver.dll</HintPath>
</Reference>
<Reference Include="ServiceStack.Text, Version=3.9.71.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ServiceStack.Text.3.9.71\lib\net35\ServiceStack.Text.dll</HintPath>
</Reference>
<Reference Include="Slack.Webhooks, Version=0.1.7.18980, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Slack.Webhooks.0.1.7\lib\net40\Slack.Webhooks.dll</HintPath>
</Reference>
<Reference Include="System">
<Name>System</Name>
</Reference>
+3
View File
@@ -26,8 +26,11 @@
<package id="MiniProfiler" version="2.1.0" targetFramework="net45" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net45" />
<package id="Owin" version="1.0" targetFramework="net45" />
<package id="RestSharp" version="104.4.0" targetFramework="net45" />
<package id="semver" version="1.1.2" targetFramework="net45" />
<package id="ServiceStack.Text" version="3.9.71" targetFramework="net45" />
<package id="SharpZipLib" version="0.86.0" targetFramework="net45" />
<package id="Slack.Webhooks" version="0.1.7" targetFramework="net45" />
<package id="System.Threading.Tasks.Dataflow" version="4.7.0" targetFramework="net45" />
<package id="xmlrpcnet" version="2.5.0" targetFramework="net45" />
</packages>