Beispiel #1
0
 public static WardenConfiguration.Builder AddAzureStorageWatcher(this WardenConfiguration.Builder builder, string name,
                                                                  string connectionString, Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?interval = null,
                                                                  string group = null)
 {
     builder.AddWatcher(AzureStorageWatcher.Create(name, connectionString, @group: group), hooks, interval);
     return(builder);
 }
Beispiel #2
0
        /// <summary>
        /// Extension method for adding the Disk watcher to the the WardenConfiguration with the default name of Disk Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddDiskWatcher(
            this WardenConfiguration.Builder builder,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(DiskWatcher.Create(), hooks);

            return(builder);
        }
Beispiel #3
0
        /// <summary>
        /// Extension method for adding the Performance watcher to the the WardenConfiguration with the default name of Performance Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the PerformanceWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="delay">Delay between resource usage calculation while using the default performance counter (100 ms by default).</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddPerformanceWatcher(
            this WardenConfiguration.Builder builder, string name,
            Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?delay = null)
        {
            builder.AddWatcher(PerformanceWatcher.Create(name, delay), hooks);

            return(builder);
        }
Beispiel #4
0
        /// <summary>
        /// Extension method for adding the Redis watcher to the the WardenConfiguration with the default name of Redis Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="connectionString">Connection string of the Redis database.</param>m
        /// <param name="database">Name of the Redis database.</param>
        /// <param name="timeout">Optional timeout of the Redis query (5 seconds by default).</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddRedisWatcher(
            this WardenConfiguration.Builder builder, string connectionString, int database,
            TimeSpan?timeout = null, Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(RedisWatcher.Create(connectionString, database, timeout), hooks);

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the MS SQL integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of MsSqlIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithMsSql(
            this WardenConfiguration.Builder builder,
            MsSqlIntegrationConfiguration configuration)
        {
            builder.AddIntegration(MsSqlIntegration.Create(configuration));

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Twilio integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of TwilioIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithTwilio(
            this WardenConfiguration.Builder builder,
            TwilioIntegrationConfiguration configuration)
        {
            builder.AddIntegration(TwilioIntegration.Create(configuration));

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Cachet integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of CachetIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithCachet(
            this WardenConfiguration.Builder builder,
            CachetIntegrationConfiguration configuration)
        {
            builder.AddIntegration(CachetIntegration.Create(configuration));

            return(builder);
        }
Beispiel #8
0
        /// <summary>
        /// Extension method for adding the MSSQL watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the MsSqlWatcher.</param>
        /// <param name="connectionString">Connection string of the MSSQL database.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddMsSqlWatcher(
            this WardenConfiguration.Builder builder, string name, string connectionString,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(MsSqlWatcher.Create(connectionString), hooks);

            return(builder);
        }
Beispiel #9
0
        /// <summary>
        /// Extension method for adding the SendGrid integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of SendGridIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithSendGrid(
            this WardenConfiguration.Builder builder,
            SendGridIntegrationConfiguration configuration)
        {
            builder.AddIntegration(SendGridIntegration.Create(configuration));

            return(builder);
        }
Beispiel #10
0
        /// <summary>
        /// Extension method for adding the Process watcher to the the WardenConfiguration with the default name of Process Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the ProcessWatcher.</param>
        /// <param name="processName">Name of the process.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddProcessWatcher(
            this WardenConfiguration.Builder builder, string name, string processName,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(ProcessWatcher.Create(name, processName), hooks);

            return(builder);
        }
Beispiel #11
0
        /// <summary>
        /// Factory method for creating a new Warden instance, for which the configuration can be provided via the lambda expression.
        /// </summary>
        /// <param name="name">Name of the Warden.</param>
        /// <param name="configurator">Lambda expression to build the configuration of Warden.</param>
        /// <returns>Instance of IWarden.</returns>
        public static IWarden Create(string name, Action <WardenConfiguration.Builder> configurator)
        {
            var config = new WardenConfiguration.Builder();

            configurator?.Invoke(config);

            return(Create(name, config.Build()));
        }
Beispiel #12
0
        /// <summary>
        /// Extension method for adding the Performance watcher to the the WardenConfiguration with the default name of Performance Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configurator">Lambda expression for configuring the PerformanceWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="delay">Delay between resource usage calculation while using the default performance counter (100 ms by default).</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddPerformanceWatcher(
            this WardenConfiguration.Builder builder,
            Action <PerformanceWatcherConfiguration.Default> configurator,
            Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?delay = null)
        {
            builder.AddWatcher(PerformanceWatcher.Create(delay, configurator), hooks);

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Twilio integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="accountSid">SID of the Twilio account.</param>
        /// <param name="authToken">Authentication token of the Twilio account.</param>
        /// <param name="sender">Phone number of the SMS sender.</param>
        /// <param name="configurator">Optional lambda expression for configuring the TwilioIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithTwilio(
            this WardenConfiguration.Builder builder,
            string accountSid, string authToken, string sender,
            Action <TwilioIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(TwilioIntegration.Create(accountSid, authToken, sender, configurator));

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the MS SQL integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="connectionString">Connection string of the MS SQL server.</param>
        /// <param name="configurator">Optional lambda expression for configuring the MsSqlIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithMsSql(
            this WardenConfiguration.Builder builder,
            string connectionString,
            Action <MsSqlIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(MsSqlIntegration.Create(connectionString, configurator));

            return(builder);
        }
Beispiel #15
0
        /// <summary>
        /// Extension method for adding the Seq integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="url">URL of the Seq instance.</param>
        /// <param name="apiKey">API key of Seq passed inside the custom "X-Seq-ApiKey" header.</param>
        /// <param name="configurator">Optional lambda expression for configuring the SeqIntegration.</param>
        public static WardenConfiguration.Builder IntegrateWithSeq(
            this WardenConfiguration.Builder builder,
            string url, string apiKey,
            Action <SeqIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(SeqIntegration.Create(url, apiKey, configurator: configurator));

            return(builder);
        }
Beispiel #16
0
        /// <summary>
        /// Extension method for adding the Process watcher to the the WardenConfiguration with the default name of Process Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="processName">Name of the process.</param>
        /// <param name="configurator">Lambda expression for configuring the ProcessWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddProcessWatcher(
            this WardenConfiguration.Builder builder, string processName,
            Action <ProcessWatcherConfiguration.Default> configurator,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(ProcessWatcher.Create(processName, configurator), hooks);

            return(builder);
        }
Beispiel #17
0
        /// <summary>
        /// Extension method for adding the Slack integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="webhookUrl">Full URL of the Slack webhook integration.</param>
        /// <param name="configurator">Optional lambda expression for configuring the SlackIntegration.</param>
        public static WardenConfiguration.Builder IntegrateWithSlack(
            this WardenConfiguration.Builder builder,
            string webhookUrl,
            Action <SlackIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(SlackIntegration.Create(webhookUrl, configurator));

            return(builder);
        }
Beispiel #18
0
        /// <summary>
        /// Extension method for adding the SendGrid integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="username">Username of the SendGrid account.</param>
        /// <param name="password">Password of the SendGrid account.</param>
        /// <param name="sender">Email address of the message sender.</param>
        /// <param name="configurator">Optional lambda expression for configuring the SendGridIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithSendGrid(
            this WardenConfiguration.Builder builder,
            string username, string password, string sender,
            Action <SendGridIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(SendGridIntegration.Create(username, password, sender, configurator));

            return(builder);
        }
Beispiel #19
0
        /// <summary>
        /// Extension method for adding the SendGrid integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="apiKey">API key of the SendGrid account.</param>
        /// <param name="sender">Email address of the message sender.</param>
        /// <param name="configurator">Optional lambda expression for configuring the SendGridIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithSendGrid(
            this WardenConfiguration.Builder builder,
            string apiKey, string sender,
            Action <SendGridIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(SendGridIntegration.Create(apiKey, sender, configurator));

            return(builder);
        }
Beispiel #20
0
        /// <summary>
        /// Extension method for adding the MSSQL watcher to the the WardenConfiguration with the default name of MSSQL Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of MsSqlWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddMsSqlWatcher(
            this WardenConfiguration.Builder builder,
            MsSqlWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(MsSqlWatcher.Create(configuration), hooks);

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Cachet integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="apiUrl">URL of the Cachet API.</param>
        /// <param name="username">Username of the Cachet account.</param>
        /// <param name="password">Password of the Cachet account.</param>
        /// <param name="configurator">Optional lambda expression for configuring the CachetIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithCachet(
            this WardenConfiguration.Builder builder,
            string apiUrl, string username, string password,
            Action <CachetIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(CachetIntegration.Create(apiUrl, username, password, configurator));

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Cachet integration to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="apiUrl">URL of the Cachet API.</param>
        /// <param name="accessToken">Access token of the Cachet account.</param>
        /// <param name="configurator">Optional lambda expression for configuring the CachetIntegration.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder IntegrateWithCachet(
            this WardenConfiguration.Builder builder,
            string apiUrl, string accessToken,
            Action <CachetIntegrationConfiguration.Builder> configurator = null)
        {
            builder.AddIntegration(CachetIntegration.Create(apiUrl, accessToken, configurator));

            return(builder);
        }
Beispiel #23
0
        /// <summary>
        /// Extension method for adding the Redis watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the RedisWatcher.</param>
        /// <param name="configuration">Configuration of RedisWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddRedisWatcher(
            this WardenConfiguration.Builder builder, string name,
            RedisWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null)
        {
            builder.AddWatcher(RedisWatcher.Create(name, configuration), hooks);

            return(builder);
        }
Beispiel #24
0
        /// <summary>
        /// Extension method for adding the MongoDB watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the MongoDbWatcher.</param>
        /// <param name="connectionString">Connection string of the MongoDB database.</param>
        /// <param name="database">Name of the MongoDB database.</param>
        /// <param name="configurator">Lambda expression for configuring the MongoDbWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="timeout">Optional timeout of the MongoDB query (5 seconds by default).</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddMongoDbWatcher(
            this WardenConfiguration.Builder builder, string name,
            string connectionString, string database,
            Action <MongoDbWatcherConfiguration.Default> configurator,
            Action <WatcherHooksConfiguration.Builder> hooks = null, TimeSpan?timeout = null)
        {
            builder.AddWatcher(MongoDbWatcher.Create(name, connectionString, database, timeout, configurator), hooks);

            return(builder);
        }
Beispiel #25
0
        /// <summary>
        /// Extension method for adding the Disk watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="name">Name of the DiskWatcher.</param>
        /// <param name="configuration">Configuration of DiskWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddDiskWatcher(
            this WardenConfiguration.Builder builder, string name,
            DiskWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(DiskWatcher.Create(name, configuration), hooks, interval);

            return(builder);
        }
Beispiel #26
0
        /// <summary>
        /// Extension method for adding the MongoDB watcher to the the WardenConfiguration with the default name of MongoDB Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configuration">Configuration of MongoDbWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddMongoDbWatcher(
            this WardenConfiguration.Builder builder,
            MongoDbWatcherConfiguration configuration,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(MongoDbWatcher.Create(configuration), hooks, interval);

            return(builder);
        }
Beispiel #27
0
        /// <summary>
        /// Extension method for adding the Disk watcher to the the WardenConfiguration.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="configurator">Lambda expression for configuring the DiskWatcher.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddDiskWatcher(
            this WardenConfiguration.Builder builder,
            Action <DiskWatcherConfiguration.Default> configurator,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(DiskWatcher.Create(configurator), hooks, interval);

            return(builder);
        }
Beispiel #28
0
        /// <summary>
        /// Extension method for adding the Process watcher to the the WardenConfiguration with the default name of Process Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="processName">Name of the process.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddProcessWatcher(
            this WardenConfiguration.Builder builder,
            string processName,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(ProcessWatcher.Create(processName), hooks, interval);

            return(builder);
        }
Beispiel #29
0
        /// <summary>
        /// Extension method for adding the Performance watcher to the the WardenConfiguration with the default name of Performance Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="delay">Delay between resource usage calculation while using the default performance counter (100 ms by default).</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddPerformanceWatcher(
            this WardenConfiguration.Builder builder,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?delay    = null,
            TimeSpan?interval = null)
        {
            builder.AddWatcher(PerformanceWatcher.Create(delay), hooks, interval);

            return(builder);
        }
        /// <summary>
        /// Extension method for adding the Disk watcher to the the WardenConfiguration with the default name of Disk Watcher.
        /// </summary>
        /// <param name="builder">Instance of the Warden configuration builder.</param>
        /// <param name="hooks">Optional lambda expression for configuring the watcher hooks.</param>
        /// <param name="interval">Optional interval (5 seconds by default) after which the next check will be invoked.</param>
        /// <param name="group">Optional name of the group that DiskWatcher belongs to.</param>
        /// <returns>Instance of fluent builder for the WardenConfiguration.</returns>
        public static WardenConfiguration.Builder AddDiskWatcher(
            this WardenConfiguration.Builder builder,
            Action <WatcherHooksConfiguration.Builder> hooks = null,
            TimeSpan?interval = null,
            string group      = null)
        {
            builder.AddWatcher(DiskWatcher.Create(group: group), hooks, interval);

            return(builder);
        }