0

Problem: I want to make sure that a certain folder is equal regarding it's contents across my servers.

I do not want an automatic filesync to keep them equal, changing is done manually.

My initial thought was to once a day calculate some crc/hash on folder and send to Zabbix, and trigger when values differ.

Is there any good tools out there that can calculate crc or similar of a folder?

Anyone know of another solution that solves my problem?

3 Answers 3

0

I had the exact same problem a while ago and wrote this bit of python code to generate that checksum:

def checksum(root):
    md5sums = {}
    items = os.path.walk(root, checksum_dir, md5sums)
    _md5sums = []
    for k in sorted(md5sums.keys()):
        _md5sums += md5sums[k]
    return md5.new(''.join(_md5sums)).hexdigest()

def checksum_dir(md5sums, path, names):
    names.sort()
    if '.git' in names:
        names.remove('.git')
    md5sums[path] = []
    for name in names:
        name = os.path.join(path, name)
        if os.path.islink(name):
            md5sums[path].append(os.readlink(name))
        elif os.path.isdir(name):
            continue
        elif os.path.isfile(name):
            fd = open(name)
            md5sums[path].append(md5.new(fd.read()).hexdigest())
            fd.close()
        else:
            raise ValueError("File %s is not a normal name or a symlink")

I wrapped it in a func module and trigger the relevant check on the funcmaster via nrpe (we use nagios, not zabbix).

0
1

There are two options for what you want: tripwire (3070678sourceforge.net/projects/tripwire/) and Aide (http://aide.sourceforge.net/).

The workflow with both is more or less the same, but as Aide is what I know, that's what I'll tell you about. To begin, you initialize a DB with sums (MD5 and SHA1) of each file that you want to monitor. Aide allows you to choose what changes you want to monitor: the contents of the file, the uid or gid, the execution bits, the block count ... Then, daily, you compare the current state of the files monitored with those in the DB. If there is any difference, Aide will tell you. Whenever you make a controlled change, you initialize the DB again.

It's not really good to integrate with Zabbix or Nagios, but maybe it helps.

0

If you're still looking for a tool that can diff between multiple servers and send alerts when there's any differences, check out www.metaforsoftware.com . You can set it up to do daily or hourly diffs. It's in free beta right now. (Full disclosure: I'm a co-founder)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .