warden-stack / Warden

Define "health checks" for your applications, resources and infrastructure. Keep your Warden on the watch.
https://getwarden.net
MIT License
615 stars 66 forks source link

Add Watcher at runtime #137

Closed biapar closed 7 years ago

biapar commented 7 years ago

Hi,

It's possible to add watchers ( like to website ) a runtime?

spetz commented 7 years ago

Hi, Currently it's not possible.

biapar commented 7 years ago

So, if I've to add a new watcher; I've to recompile the solution?

spetz commented 7 years ago

Yes, at first I've built this library in order to be able to create e.g. a console application that will be treated as monitor and I didn't think about dynamically updating the watchers, but for sure I'll take a look into that issue in the upcoming days, as it shouldn't be too difficult to implement. I've just created a new issue #138 for this feature :).

spetz commented 7 years ago

@biapar I've just published version 1.3.2 - please take a look at the wiki -> Reconfigure() or at this blog post. Let me know if that's working ok for you.

biapar commented 7 years ago

Like it...especially web layout that I see in the blog post. So, I've pass to Reconfigure a WardenConfiguration. Is't right?

spetz commented 7 years ago

Thanks! You can just use lambda expression and it will update the already existing WardenConfiguration instance (no need to pass it as an argument).

ainasiart commented 7 years ago

The Reconfigure is not working as expected; It adds the watcher to the list but it doesn't do the checking process. I use the very simple command below warden.Reconfigure(x => x.AddProcessWatcher(name: "Test Excel",processName:"EXCEL",configurator: cfg => cfg.EnsureThat(p => p.Exists),machineName:"MyMachineName",hooks:cfg=>cfg.OnCompleted(result => MessageBox.Show(result.IsValid.ToString())) ));

I pause the program to see the warden._configuration.Watchers, and the Text Excel above is there, only not executing

yodamon commented 7 years ago

Hi, I created a service that dynamically add web monitors from a database and I want call the Reconfigure if there is a change in my data from the database. I'm not really sure where/when to issue the warden.Reconfigure(). I'm using the Async model, are there any full code examples of using the Reconfigure.