Search
j0ke.net Open Build Service
>
Projects
>
server:monitoring
:
icinga
:
production
>
nagios-plugins-nfs
> check_mountpoints.py
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File check_mountpoints.py of Package nagios-plugins-nfs
#!/usr/bin/python import string import sys fstab_content=open('/etc/fstab','r') mountlist = list() i=0 exitstatus=1 mounted=False mountstate='Mounts not OK' for line in fstab_content: if '#' not in line and len(line) > 2 and 'nfs' in line: (fstabfs,fstabmountpt,fstabtype,fstaboptions,fstabdump,fstabpass)=line.strip().split() procmounts_content=open('/proc/mounts','r') for line in procmounts_content: ((procfs,procmountpt,proctype,procoptions,procdump,procpass))=line.strip().split() if fstabtype == 'nfs' and proctype == 'nfs': if fstabmountpt == procmountpt: mounted=True procmounts_content.close() if mounted: exitstatus=0 mountstate='Mounts OK' else: exitstatus=1 mountstate="Mounts not OK" print mountstate sys.exit(exitstatus) mounted=False print mountstate sys.exit(exitstatus)