Xymon Mailing List Archive search

Alert on files out of sync?

5 messages in this thread

list Tom Moore · Wed, 10 Feb 2010 10:53:11 -0500 ·
Greetings,

I'm trying to figure out the best way for Xymon to alert when it detects that a httpd.conf file on two different webheads is different.  Due to safety reasons we don't automate our web server config files, but rather use change control to keep them managed.  I want to be able to see if someone modifies one config file on one server, but forgets to do it on the second one.   I guess I could write a backend script to do it, but thought maybe there was a way to leverage the FILE monitor in hobbit-clients.cfg.

TIA,
Tom
list Wiskbroom · Wed, 10 Feb 2010 11:06:00 -0500 ·
quoted from Tom Moore
Greetings,

I'm trying to figure out the best way for Xymon to alert when it detects that a httpd.conf file on two different webheads is different. Due to safety reasons we don't automate our web server config files, but rather use change control to keep them managed. I want to be able to see if someone modifies one config file on one server, but forgets to do it on the second one. I guess I could write a backend script to do it, but thought maybe there was a way to leverage the FILE monitor in hobbit-clients.cfg.
You could md5sum the file prior to your copy over, then test the results to determine that they match.
So, 

1.  Create new file.
2.  md5sum the file, saving output to test against.
3.  copy the file over using your usual methods.
4.  run md5sum on both servers, they should match.

The only problem I see here is that you will have to auto-gen an md5sum signature each time you modify your files.

.vadim
list Rich Smrcina · Wed, 10 Feb 2010 10:11:30 -0600 ·
A quick thought.... use rsync to eliminate the human from having to 
remember about the second web server.
quoted from Tom Moore

On 02/10/2010 09:53 AM, Tom Moore wrote:
Greetings,

I'm trying to figure out the best way for Xymon to alert when it detects that a httpd.conf file on two different webheads is different.  Due to safety reasons we don't automate our web server config files, but rather use change control to keep them managed.  I want to be able to see if someone modifies one config file on one server, but forgets to do it on the second one.   I guess I could write a backend script to do it, but thought maybe there was a way to leverage the FILE monitor in hobbit-clients.cfg.

TIA,
Tom

-- 

Rich Smrcina
Phone: XXX-XXX-XXXX
http://www.linkedin.com/in/richsmrcina

Catch the WAVV! http://www.wavv.org
WAVV 2010 - Apr 9-13, 2010 Covington, KY
list Tom Schmitt · Wed, 10 Feb 2010 09:16:52 -0700 ·
Just copy over the file from machineA (call it mfileA) to machineB.  Assume file on B is mfileB.
Then do a 'diff' command and either trap the output or check the return code for zero = no difference.

Check the Return Code:
diff mfileA mfileB 2>&1 >/dev/null    		so there is no output created
if [ $? -eq 0 ]; then
    Files both match
else
    Files do not match
fi

or trap the input as in:
DATA=`diff mfileA mfileB 2>/dev/null`  		blocks error messages
if [ "$DATA" = "" ]; then
    Files both match
else
    Files do not match
fi
   

         Thanks,
         
         Tom Schmitt
         Senior IT Staff - R&D
         Salt Lake City, UT  XXXXX
         Phone (XXX) XXX-XXXX
         Cell      (XXX) XXX-XXXX
     
                 \\\\||////
                  \ ~  ~ /  
                  | @  @ |   
     		--oOo---(_)---oOo--
quoted from Rich Smrcina


-----Original Message-----
From: user-ddebaeecde97@xymon.invalid [mailto:user-ddebaeecde97@xymon.invalid] 
Sent: Wednesday, February 10, 2010 9:06 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: RE: [hobbit] Alert on files out of sync?

Greetings,

I'm trying to figure out the best way for Xymon to alert when it detects that a httpd.conf file on two different webheads is different. Due to safety reasons we don't automate our web server config files, but rather use change control to keep them managed. I want to be able to see if someone modifies one config file on one server, but forgets to do it on the second one. I guess I could write a backend script to do it, but thought maybe there was a way to leverage the FILE monitor in hobbit-clients.cfg.
You could md5sum the file prior to your copy over, then test the results to determine that they match.
So, 

1.  Create new file.
2.  md5sum the file, saving output to test against.
3.  copy the file over using your usual methods.
4.  run md5sum on both servers, they should match.

The only problem I see here is that you will have to auto-gen an md5sum signature each time you modify your files.

.vadim
list Tom Moore · Wed, 10 Feb 2010 13:07:49 -0500 ·
Yea I would do that but having to script and rsync with a httpd reload is asking for trouble.  I don't want the rsync to somehow fail one day (or even the conf having an error) and then it goes ahead and HUPs the apache on the second server, which then fails along with the first.
quoted from Rich Smrcina


-----Original Message-----
From: Rich Smrcina [mailto:user-cf452ff334e0@xymon.invalid] 
Sent: Wednesday, February 10, 2010 11:12 AM
To: user-ae9b8668bcde@xymon.invalid
Subject: Re: [hobbit] Alert on files out of sync?

A quick thought.... use rsync to eliminate the human from having to 
remember about the second web server.

On 02/10/2010 09:53 AM, Tom Moore wrote:
Greetings,

I'm trying to figure out the best way for Xymon to alert when it detects that a httpd.conf file on two different webheads is different.  Due to safety reasons we don't automate our web server config files, but rather use change control to keep them managed.  I want to be able to see if someone modifies one config file on one server, but forgets to do it on the second one.   I guess I could write a backend script to do it, but thought maybe there was a way to leverage the FILE monitor in hobbit-clients.cfg.

TIA,
Tom

-- 
Rich Smrcina
Phone: XXX-XXX-XXXX
http://www.linkedin.com/in/richsmrcina

Catch the WAVV! http://www.wavv.org
WAVV 2010 - Apr 9-13, 2010 Covington, KY