fix output

This commit is contained in:
2020-03-15 11:53:57 +00:00
parent 25c375cf1e
commit a399701755
3 changed files with 29 additions and 24 deletions

View File

@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RootNamespace>Cachet_Monitor</RootNamespace>
<AssemblyVersion>0.1.1.0</AssemblyVersion>
<FileVersion>0.1.1.0</FileVersion>
<AssemblyVersion>2020.3.13.0</AssemblyVersion>
<FileVersion>2020.3.13.0</FileVersion>
<Version>0.1.1</Version>
</PropertyGroup>
@@ -23,15 +23,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CachNet" Version="0.0.1" />
<PackageReference Include="CachNet" Version="0.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="RestEase" Version="1.4.10" />
</ItemGroup>
<ItemGroup>
<Reference Include="CachNet">
<HintPath>..\CachNet.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -1,6 +1,4 @@
using System;
namespace Cachet_Monitor.Models.Config
namespace Cachet_Monitor.Models.Config
{
public enum MonitorType
{

View File

@@ -12,6 +12,8 @@ using System.Net;
using System.Diagnostics;
using CachNet.Entities;
using System.Net.NetworkInformation;
using System.Collections.Generic;
using System.Linq;
namespace Cachet_Monitor
{
@@ -86,9 +88,10 @@ namespace Cachet_Monitor
tcpClient.Connect(monitor.Target, monitor.Settings.Port);
try
{
componentStatus = ComponentStatus.Operational;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.Operational,
Status = componentStatus,
});
Log.Debug("PortMonitorCheck", "Sent to Cachet successfully");
}
@@ -103,9 +106,10 @@ namespace Cachet_Monitor
try
{
componentStatus = ComponentStatus.MajorOutage;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.MajorOutage,
Status = componentStatus,
});
Log.Debug("PortMonitorCheck", "Sent to Cachet successfully");
}
@@ -145,9 +149,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.Operational;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.Operational,
Status = componentStatus,
});
Log.Debug("IPMonitorCheck", "Sent to Cachet successfully");
}
@@ -161,9 +166,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.PerformanceIssues;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.PerformanceIssues,
Status = componentStatus,
});
Log.Debug("IPMonitorCheck", "Sent to Cachet successfully");
}
@@ -179,9 +185,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.PartialOutage;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.PartialOutage,
Status = componentStatus,
});
Log.Debug("IPMonitorCheck", "Sent to Cachet successfully");
}
@@ -194,9 +201,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.MajorOutage;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.MajorOutage,
Status = componentStatus,
});
Log.Debug("IPMonitorCheck", "Sent to Cachet successfully");
}
@@ -226,9 +234,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.Operational;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.Operational,
Status = componentStatus,
});
Log.Debug("WebMonitorCheck", "Sent to Cachet successfully");
}
@@ -241,9 +250,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.PartialOutage;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.PartialOutage,
Status = componentStatus,
});
Log.Debug("WebMonitorCheck", "Sent to Cachet successfully");
}
@@ -269,9 +279,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.Operational;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.Operational,
Status = componentStatus,
});
Log.Debug("WebMonitorCheck", "Sent to Cachet successfully");
}
@@ -288,9 +299,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.PerformanceIssues;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.PerformanceIssues,
Status = componentStatus,
});
Log.Debug("WebMonitorCheck", "Sent to Cachet successfully");
}
@@ -303,9 +315,10 @@ namespace Cachet_Monitor
{
try
{
componentStatus = ComponentStatus.MajorOutage;
await Cachet.UpdateComponentAsync(monitor.ComponentId, new PutComponent
{
Status = ComponentStatus.MajorOutage,
Status = componentStatus,
});
Log.Debug("WebMonitorCheck", "Sent to Cachet successfully");
}