Skip to content

Commit 84c0887

Browse files
committed
Merge pull request ganglia#120 from hashar/diskstat-empty-devices
diskstat: really discover devs when devices is missing
2 parents e2e3bcb + e9a4930 commit 84c0887

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

diskstat/python_modules/diskstat.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
### more information on these values, look in the Linux kernel
77
### documentation for "I/O statistics fields".
88
###
9+
### By default, the script would monitor any entry listed under
10+
### /proc/diskstats that is not containing a number. Override it by passing
11+
### a list of devices in the 'devices' parameter.
12+
###
913
### This script has the option of explicitly setting which devices
1014
### to check using the "devices" option in your configuration. If
1115
### you set this value, it will invalidate the MIN_DISK_SIZE and
@@ -58,7 +62,9 @@
5862

5963
# 5 GB
6064
MIN_DISK_SIZE = 5242880
61-
DEVICES = ''
65+
# Set to None to trigger disk discovery under /proc/diskstats
66+
# Pass a 'devices' parameter to explicitly list disks to monitor
67+
DEVICES = None
6268
IGNORE_DEV = 'dm-|loop|drbd'
6369

6470
PARTITIONS_FILE = '/proc/partitions'
@@ -162,7 +168,7 @@ def get_partitions():
162168
logging.debug('getting partitions')
163169
global PARTITIONS
164170

165-
if DEVICES != '':
171+
if DEVICES is not None:
166172
# Explicit device list has been set
167173
logging.debug(' DEVICES has already been set')
168174
out = DEVICES
@@ -179,7 +185,7 @@ def get_partitions():
179185
return p.returncode
180186

181187
for dev in out.split():
182-
if DEVICES != '':
188+
if DEVICES is not None:
183189
# Explicit device list has been set
184190
PARTITIONS.append(dev)
185191
else:

0 commit comments

Comments
 (0)