I have Windows server that receives a set of files everyday at 3am. This server has the check_mk client installed. I would like for check_mk to monitor that the files exist.
I would ideally like the check to occur once a day at about 3:30am as the files should be there by then and I want to know ASAP if they aren’t.
I could add a script to the client local folder to check for the existence of the files but that would unnecessarily run multipe times per day. I know you can set a cache_age for the script but I want to ensure it is run at a specific time of the day. Is it possible to schedule a local script to run at a specific time once a day?
I thought I read somewhere that you can pop a specifically formatted file somewhere in the check_mk client install folder for it to read from rather than having a script run. Is this correct?
I’ve also read about passive checks but have been unable to determine if that would be a solution.
Hi,
you can use time periods to schedule the check or time specific values depending on your rules.
When you build a timeperiod from 3:30 to 3:31 and configure the check running in this time period, it will only run once.
first @ChristianM, i don’t think that works here as long as it is not an active check. The files
are on the client servers, so you need an plugin/local script to run, because he only wants to run the whole plugin only at a specific time. You won’t get around at least running a part of the script without checking the time at the moment.
@jcrow, i would recommend a combination out of a local script and a check-interval or a plugin and check + check_interval. With the plugin-format you can print an specific string so that your check knows, that it has no new information. Then you can raise an “MKCounterWrapped”-Exception, then the service should go on stale. I can’t say, if this works on 1.6 though.
The local-script cominbation works close to that above, but you wouldn’t have any output from your skript and the service would become a “vanished service” marking at your service discovery.
One thing I’m not sure of with local scripts is how check_mk interacts with them.
If I have local scripts then I assume they only run when check_mk tells the client to run them. Would a time period affect all the local scripts on the host, as check_mk wouldn’t know which script is associated with which service. If I had another script on the same server that checked that a specific process is running (which I would want to constantly monitor) would that be affected as well?
It doesn’t appear as if time periods can be applied to specific services, only hosts. Is this correct?
Are the files remaining in the directory or are they deleted after they are processed?
Thinking about fileinfo and checking the age of file is not older than 24h.
Schedule a script in the Windows task scheduler to run daily at 3.30am.
It checks the expected presence and date of the files and writes the result into the spool directory of the agent:
<<<local>>>
0 FooFiles_Update count=30 All files are up to date.
You will get a new service “FooFiles_Update”.
To ensure that the scheduled task runs daily, let it create/touch a state file which you can monitor with CheckMK for its age. You will be notified when the file gets older than 24h. (I do not know if its possible to monitor the last execution time of a windows task) In addition you can monitor the last state of the task.