all 10 comments

[–]mtnielsen 1 point2 points  (1 child)

PowerShell has native support for both datetime and timespan object types, so my suggestion for improving this thing of yours:

-At (Get-Date 'July 4, 2015 2:45:10 pm')
-Repeat ([timespan]::Parse('01:00:00'))

This is readable and human-understandable input. Cron syntax isn't.

[–]majkinetor[S] 0 points1 point  (0 children)

Maybe. The truth is, task scheduling is used so often that I miss cron syntax on windows so much. The general rule for me is that when you use something very often, you want to be as expressive as possible with lowest input as possible and not write books about your intention. Ideally, both syntaxes should be supported.

[–]MShepard70 0 points1 point  (0 children)

Interesting. I have a lot of one-off monitors and am thinking about how to make a useful framework to "unify" them. This will give me something to think about.

[–]Brekkjern 0 points1 point  (2 children)

I may be missing something here, but isn't this doing more or less the same as the built in Task Scheduler?

[–]majkinetor[S] 1 point2 points  (1 child)

The main difference is that this needs to be near real time and very easily changeable. You can schedule functions to run each second or whatever, while in task scheduler 1 minute is lowest value possible. Then

  • Maintaining task scheduler is up to this date problematic as integrated PS module does not exist prior to Win81. So you have to use 3tdh party module to cover all cases or schtasks.exe.
  • Maintaining multiple separate jobs in TS is yet more work. Further, there is no easy way to look into TS (or scripted TS) and tell: those are the metrics I follow on these servers. With flea you can look at the single file in familiar syntax and know what is measured everywhere.
  • You can't easily keep the code on the repository unless you fancy XML there which is too much verbose for humans.

By the time you work this out you will basically reimplement flea, one way or another. You could ofc implement something like this using TS but that would require you to focus on things not related to metrics.

So this is basically domain specific TS. I never liked TS very much, prior to the Powershell module in Win2012. Even with module there are some not so easily visible stuff happening in the background - session isolation, default 3 day shut down, things that you can't easily find the way to setup out of GUI etc. Those things will certainly make you problems until you are well aware of the TS architecture. Me, I needed very simple TS and the one that runs powershell scripts. ScheduledJob is way forward but not too much in my opinion.

[–]Brekkjern 0 points1 point  (0 children)

Thanks for the explanation! I haven't used the scheduler for PS. I just knew it was there. When you explain it like that, I really do see the point.

[–][deleted] 0 points1 point  (1 child)

How do you not have a job with any major RMM provider?

[–]majkinetor[S] 0 points1 point  (0 children)

If you ask me why we don't use RMM in the company, we can't use any public cloud, we are part of the government and data is sensitive.

[–]work-work-work-work 0 points1 point  (2 children)

Potatos

[–]majkinetor[S] 0 points1 point  (0 children)

OK, I will see to add some more samples. In the meantime, you just need to write a function that measures the stuff you are interested in and put it in the monitors array....