monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Is it possible to compare timestamps?


From: Martin Pala
Subject: Re: Is it possible to compare timestamps?
Date: Thu, 18 Aug 2011 16:35:43 +0200

Hi Marcus,

such comparison is not supported with the current checksum test, but you can 
delegate the postmap execution to monit like this:
--8<--
check file sasl_passwd with path /etc/postfix/sasl_passwd
    if changed checksum then exec "/usr/bin/postmap /etc/postfix/sasl_passwd"
--8<--

=> it will run the postmap unconditionally and you don't need to run it 
manually (if you'll do so, it shouldn't be problem, the postman will run twice 
- once manually and once by monit).



The next Monit release will support custom check scripts, so you will be able 
to set it like this:
--8<--
check program postmapper with path /usr/local/bin/postmap_compare_timestamps.sh
    if status != 0 then alert
--8<--

where the postmap_compare_timestamps.sh is custom shell script which will 
compare timestamps of all postfix databases vs. their source files.


Regards,
Martin


On Aug 18, 2011, at 1:46 PM, Marcus Mülbüsch wrote:

> Hello all,
> 
>   I'd like to compare timestamps of two files and have monit alert me if one 
> is newer than the other.
> 
>   Case in point: Postfix uses some configuration files that have to converted 
> into DB-format using the command "postmap /etc/postfix/sasl_passwd". If you 
> do forget that, your changes made into the text-File have no effect.
> 
>   Now I'd like to compare whether the text-file has a newer timestamp than 
> the db-file; so I am alerted that I forgot that.
> 
>   Is this possible?
> 
> Thanks,
> 
> Marcus
> 
> --
> To unsubscribe:
> https://lists.nongnu.org/mailman/listinfo/monit-general




reply via email to

[Prev in Thread] Current Thread [Next in Thread]