EonaCat.ServiceMonitor
1.1.4
Prefix Reserved
See the version list below for details.
dotnet add package EonaCat.ServiceMonitor --version 1.1.4
NuGet\Install-Package EonaCat.ServiceMonitor -Version 1.1.4
<PackageReference Include="EonaCat.ServiceMonitor" Version="1.1.4" />
paket add EonaCat.ServiceMonitor --version 1.1.4
#r "nuget: EonaCat.ServiceMonitor, 1.1.4"
// Install EonaCat.ServiceMonitor as a Cake Addin #addin nuget:?package=EonaCat.ServiceMonitor&version=1.1.4 // Install EonaCat.ServiceMonitor as a Cake Tool #tool nuget:?package=EonaCat.ServiceMonitor&version=1.1.4
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:
- Address.
- Port.
- Protocol to monitor.
- 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 | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.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. |
-
.NETStandard 2.1
- EonaCatHelpers (>= 1.5.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.