Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ cat gluster-check.py
- #!/usr/bin/env python
- # -*- coding: iso-8859-15 -*-
- import os
- data = os.popen("gluster v status").readlines()
- # first we'll parse through the raw data looking for brick information
- for x in data:
- if 'Brick' in x:
- d = x.rstrip().split('\t')
- if d[5] == 'Y':
- status = 'ONLINE'
- else:
- status = 'OFFLINE'
- pid = d[6]
- name = d[0].split(' ')[1]
- # and output it with a little formatting
- print "Volume: %s\t(PID %s)\t\tStatus: %s" % (name, pid, status)
- [jduncan@laptop ~]$ sudo python gluster-check.py
- Volume: 192.168.1.140:/gluster2 (PID 5629) Status: ONLINE
- Volume: 192.168.1.140:/gluster (PID 5603) Status: ONLINE
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement