On utilise le probe fstab.local pour générer la conf des disques pour monit
darcs-hash:20080210175932-af139-986ad9079d735eab098a0204621c64945e1d4314.gz
This commit is contained in:
parent
c6ef19d4eb
commit
08cd541ea1
7 changed files with 72 additions and 93 deletions
|
@ -1,5 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
# -*- mode: python -*-
|
||||
# -*- coding: utf-8; mode: python -*-
|
||||
|
||||
import sre
|
||||
|
||||
info["owner"] = "root"
|
||||
info["group"] = "root"
|
||||
|
@ -286,3 +287,64 @@ if has("vsftpd-federez"):
|
|||
@ if 5 restarts within 5 cycles then timeout
|
||||
@
|
||||
|
||||
# on ne monitore pas les disques de canard
|
||||
if hostname in ['canard'] :
|
||||
done()
|
||||
|
||||
for line in metadata.probes["fstab.local"].splitlines():
|
||||
# on supprime les espaces
|
||||
line = line.strip()
|
||||
|
||||
# on saute les lignes inintérassantes
|
||||
if not line :
|
||||
continue
|
||||
if line[0] == "#" :
|
||||
continue
|
||||
|
||||
# on découpe la ligne
|
||||
[fs, mntpoint, type, options, dump, pass_] = sre.split('[ \t]*',line)
|
||||
options = options.split(",")
|
||||
|
||||
# on saute si c'est une partition non montée au démarrage
|
||||
if "noauto" in options:
|
||||
continue
|
||||
|
||||
# on saute si c'est une partition bind
|
||||
if "bind" in options:
|
||||
continue
|
||||
|
||||
# on saute les système pas intéressants
|
||||
if type in ['swap','proc','tmpfs','sysfs', 'nfs']:
|
||||
continue
|
||||
|
||||
# on ajoute les lignes de configuration générale
|
||||
comment("partition %s" % mntpoint)
|
||||
print 'check device fs%s with path %s' % (line[1], line[0])
|
||||
|
||||
print ' if failed permission 660 then alert'
|
||||
print ' if failed uid root then alert'
|
||||
print ' if failed gid disk then alert'
|
||||
|
||||
# place sur les disques
|
||||
alert_level = {
|
||||
('sila','/var/spool/squid1') : None,
|
||||
('sila','/var/spool/squid2') : None,
|
||||
('egon','/pubftp') : 95,
|
||||
('sila','/var/log/squid') : 92,
|
||||
('sila','/pubftp') : 92
|
||||
}.get((hostname, mntpoint), -1)
|
||||
if alert_level == -1:
|
||||
if mntpoint in ('/usr', '/var/lib/mailman', '/localhome'):
|
||||
alert_level = 90
|
||||
else:
|
||||
alert_level = 80
|
||||
|
||||
if alert_level:
|
||||
print ' if space usage > %d%% then alert' % alert_level
|
||||
|
||||
# inodes pour les disques
|
||||
if type != 'reiserfs' :
|
||||
print ' if inode usage > 80% then alert'
|
||||
|
||||
print ' mode passive'
|
||||
print
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue