EonaCat.ServiceMonitor 1.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package EonaCat.ServiceMonitor --version 1.0.0
NuGet\Install-Package EonaCat.ServiceMonitor -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EonaCat.ServiceMonitor" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EonaCat.ServiceMonitor --version 1.0.0
#r "nuget: EonaCat.ServiceMonitor, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EonaCat.ServiceMonitor as a Cake Addin
#addin nuget:?package=EonaCat.ServiceMonitor&version=1.0.0

// Install EonaCat.ServiceMonitor as a Cake Tool
#tool nuget:?package=EonaCat.ServiceMonitor&version=1.0.0

EonaCat.ServiceMonitor

EonaCat Service Monitor + Slack Client

Service Monitor

The service monitor has a StatusChecker with the following functionality:

  • Initiate pings via the ICMP protocol.
  • Monitor ports via the TCP protocol.
  • Monitor ports via the UDP protocol.
  • Monitor ports via the WEB protocol. (Port 80 / 443)
Creating the StatusChecker

There is no need to create the StatusChecker. Just call the CheckHostAsync method on the class itself:

The CheckHostAsync method need to have the following parameters:

  1. Address.
  2. Port.
  3. Protocol to monitor.
  4. Timeout In miliseconds. (optional) (default: 5000)

To monitor a port using the StatusChecker the following code can be used:

using static EonaCat.ServiceMonitor.StatusChecker;
var result = await StatusChecker.CheckHostAsync("https://EonaCat.com", 80, MONITOR_PROTOCOL.WEB);

As a result you would get a ServiceStatus object containing the following properties:

  • Host.
  • Exception. (empty when no exception occurred)
  • Port.
  • ErrorMessage (empty if no errorMessage was received)
  • CertificateInformation. (If using the WEB protocol information about the certificate for the website is given)
  • IP. (ipAddress of the server)
  • LastUpdated. (last status check update)
Certificate information

The certificate information class contains the following properties:

  • Exception. (null when no exception occurred during the check)
  • DaysRemaining (the days remaining before the certificate expires)
  • HasException (set to true when an exception occurred)
  • DistinguisedName (The name of the certificate)
  • ExpirationDate (The date when the certificate will expire as a DateTime object)
  • ExpirationDateAsString (The date when the certificate will expire as a string)
  • IssuerName (The issuerName of the certificate)
  • PublicKey (the publicKey used for the certificate)

Slack Client

The slack client can be used to post messages via JSON Payloads to the Slack Chat Client.

Creating the slack client:

First the slack client needs to be instantiated with a URL containing the access token for the Slack platform. This can be done using the following code:

const string ACCESS_TOKEN = $"MY_PRIVATE_ACCESS_TOKEN";
const string SLACK_URL = $"https://slack.com/{ACCESS_TOKEN}";

SlackClient slackClient = new SlackClient(SLACK_URL);
Creating and posting the payload:

To create the payload for the slack client the following code can be used:

Payload payload = new Payload();
payload.Channel = "EonaCat";
payload.Text = "Hello NuGet users";
payload.Icon = "pizza";
payload.Username = "C# information bot";

Then it's just a matter of posting the payload:

slackClient.PostMessage(payload);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.1.5 446 9/16/2022
1.1.4 404 7/29/2022