Skip to content

Commit 3272c6f

Browse files
committed
updates to the dashboard
1 parent cc9501d commit 3272c6f

2 files changed

Lines changed: 12 additions & 31 deletions

File tree

β€Ždashboard/stats_maker.pyβ€Ž

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,13 @@ def get_result(cmd):
99
x.stdout.close()
1010
return ret
1111

12-
def fix_size(size):
13-
if size.endswith('T'):
14-
size = float(size[:-1]) * 2**40
15-
elif size.endswith('G'):
16-
size = float(size[:-1]) * 2**30
17-
elif size.endswith('M'):
18-
size = float(size[:-1]) * 2**20
19-
return int(size)
20-
2112
def get_available():
22-
raw = get_result('/usr/sbin/zfs get available tank')
23-
size = raw.split()[-2]
24-
return fix_size(size)
13+
raw = int(get_result('/usr/sbin/zfs get -H -o value -p available tank').strip())
14+
return raw
2515

2616
def get_used():
27-
raw = get_result('/usr/sbin/zfs get used tank')
28-
size = raw.split()[-2]
29-
return fix_size(size)
17+
raw = int(get_result('/usr/sbin/zfs get -H -o value -p used tank').strip())
18+
return raw
3019

3120
def get_uptime():
3221
raw = get_result('/usr/gnu/bin/uptime')
@@ -45,23 +34,15 @@ def get_uptime():
4534
stats = {}
4635
start_time = time.time()
4736

48-
rpool_status = False # assume the worst
37+
rpool_status = 'Not Healthy' # assume the worst
4938
if get_result('/usr/sbin/zpool status -x rpool').endswith('is healthy'):
50-
rpool_status = True
39+
rpool_status = 'Healthy'
5140
stats['rpool_healthy'] = rpool_status
52-
if rpool_status:
53-
stats['rpool_warning'] = ''
54-
else:
55-
stats['rpool_warning'] = 'warning'
5641

57-
tank_status = False # assume the worst
42+
tank_status = 'not Healthy' # assume the worst
5843
if get_result('/usr/sbin/zpool status -x tank').endswith('is healthy'):
59-
tank_status = True
44+
tank_status = 'Healthy'
6045
stats['tank_healthy'] = tank_status
61-
if tank_status:
62-
stats['tank_warning'] = ''
63-
else:
64-
stats['tank_warning'] = 'warning'
6546

6647
stats['file_server_uptime'] = get_uptime()
6748

@@ -123,10 +104,10 @@ def get_uptime():
123104
'''
124105

125106
pools = '<div id="pools"><h3>Filesystem Status</h3><div id="rpool_status"'
126-
if stats['rpool_healthy'] is False:
107+
if stats['rpool_healthy'] == 'Not Healthy':
127108
pools += ' class="warning"'
128109
pools += '><span>rpool</span><span>%(rpool_healthy)s</span></div><div id="tank_status"'
129-
if stats['tank_healthy'] is False:
110+
if stats['tank_healthy'] == 'Not Healthy':
130111
pools += ' class="warning"'
131112
pools += '><span>tank</span><span>%(tank_healthy)s</span></div></div>'
132113

β€Ždashboard/styles.cssβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
body {
22
width: 600px;
33
color: #ccc;
4-
background: #000;
4+
background: rgb(34,34,34);
55
font-family: Futura, sans;
66
size: 24pt;
77
}
88

99
body #server_stats, body #website_stats {
1010
float: left;
1111
-webkit-border-radius: 10px;
12-
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#555), to(#333));
12+
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#333), to(#111));
1313
color: #ccc;
1414
width: 250px;
1515
padding: 10px;

0 commit comments

Comments
 (0)