Monit state file version warning - auto recover/delete bad state file ?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Monit state file version warning - auto recover/delete bad state file ?

Ani A
Hello,

I am running Monit version 5.17.1 on Ubuntu 14.04. At times, I see
that Monit has logged the following:

[PST Nov 14 15:42:40] warning  : State file '/var/lib/monit/state':
incompatible version 2

And after this, my services (that are monitored by Monit) restart.
What can cause this to happen? Is this just file corruption ?
Let's say that this occurred, is there some way in Monit to
check/correct (maybe delete and recreate state file) ?

I am seeing this more often lately, and on production hosts! Any
workarounds would be of
immense help

Thanks.
--
Ani

Reply | Threaded
Open this post in threaded view
|

Re: Monit state file version warning - auto recover/delete bad state file ?

Lutz Mader
Hello Ani,
are you installing a new version, are you updating some times ago?

> I am running Monit version 5.17.1 on Ubuntu 14.04. At times, I see
> that Monit has logged the following:
>
> [PST Nov 14 15:42:40] warning  : State file '/var/lib/monit/state':
> incompatible version 2

You can stop monit and delete the monit status file. After you start
monit again, the status file will created again.
If you get the error some times later again, something is going wrong.

With regards,
Lutz

p.s.
See https://mmonit.com/monit/documentation/monit.html#FILES
to get some more information about the used files.

I delete the monit status file all the time I update monit or I kill the
monit process.

Reply | Threaded
Open this post in threaded view
|

Re: Monit state file version warning - auto recover/delete bad state file ?

Ani A
In reply to this post by Ani A
Hi Lutz,

> are you installing a new version, are you updating some times ago?
I haven't updated Monit as I am still running an older version of Ubuntu (14.04)

> You can stop monit and delete the monit status file. After you start
> monit again, the status file will created again.

Are you telling that I should just delete the status file each time I
stop Monit ?
I know that deleting status file and restarting will create it back...
What I was looking for, is a proactive measure to avoid this situation
altogether...
(if there is any such workaround)

Thanks.
--
Ani

Reply | Threaded
Open this post in threaded view
|

Re: Monit state file version warning - auto recover/delete bad state file ?

Lutz Mader
Hello Ani,
no, you should delete the status file only once, after you change the
monit version. To do this, monit must stopped. With the next monit
startup, the status file will created again.

>> You can stop monit and delete the monit status file. After you start
>> monit again, the status file will created again.
> Are you telling that I should just delete the status file each time I
> stop Monit ?

On the other hand, I delete the status monit file all the time I kill
monit, to prevent problems.
You should check your environment to clarify that you start monit only
once, with this status file.

With regards,
Lutz