import json
import sys
from toolbox.graphite.functions import *
from toolbox.graphite import Graphite, GraphiteQuery
from ..model import *

def gbc_demo_dashboard():
    return Dashboard(name='gbc_demo',
                     category='Gooeybuttercake',
                     title='System Overview',
                     queries = {
                         'cpu' : "group(aliasByNode(servers.s030[2-7].sysstat.cpu.all.system,1,5), aliasByNode(servers.s030[2-7].sysstat.cpu.all.user,1,5))",
                         'cpu_context_switches' : 'aliasByNode(servers.s030[2-7].sysstat.context_switches.context_switches,1)',
                         'tcp_sockets' : 'aliasByNode(servers.s030[2-7].sysstat.sockets.tcp,1)',
                         'disk_reads'  : 'aliasByNode(servers.s030[2-7].sysstat.io.blocks_read,1)',
                         'disk_writes' : 'aliasByNode(servers.s030[2-7].sysstat.io.blocks_written,1)'
                     },
                     grid=Grid(
                         Heading(text='CPU'),
                         Row(Cell(span=10, offset=2,
                                  presentation=StandardTimeSeries(css_class='height4',
                                                                  title='CPU Usage',
                                                                  y_axis_label='CPU Usage %',
                                                                  query_name='cpu')))
                         ,Row(Cell(span=2,
                                   presentation=[SingleStat(title='Mean Context Switches',
                                                           query_name='cpu_context_switches',
                                                           transform='mean',
                                                           units=' /sec',
                                                           decimal=0)
                                                 ,SingleStat(title='Max Context Switches',
                                                             query_name='cpu_context_switches',
                                                             transform='max',
                                                             units=' /sec',
                                                             decimal=0)
                                             ]
                               )
                             ,Cell(span=10,
                                   presentation=StackedAreaChart(css_class='height4',
                                                                 title='CPU Context Switches',
                                                                 y_axis_label='Context Switches per Second',
                                                                 query_name='cpu_context_switches')))
                         ,Heading(text='Network')
                         ,Row(Cell(span=2,
                                   presentation=[SingleStat(title='Mean TCP Sockets',
                                                           query_name='tcp_sockets',
                                                           transform='mean',
                                                           decimal=0)
                                                 ,SingleStat(title='Max TCP Sockets',
                                                             query_name='tcp_sockets',
                                                             transform='max',
                                                             decimal=0)
                                                         ])
                             ,Cell(span=10,
                                   presentation=StackedAreaChart(css_class='height4',
                                                                 title='TCP Sockets',
                                                                 y_axis_label='Open TCP Socket Count',
                                                                 query_name='tcp_sockets')))
                     ))

@@ -1241,102 +1241,8 @@
 e',%0A
-                                                                  y_axis_label='CPU Usage %25',%0A
     
@@ -1319,24 +1319,24 @@
 me='cpu')))%0A
+
             
@@ -2494,117 +2494,8 @@
 s',%0A
-                                                                 y_axis_label='Context Switches per Second',%0A
     
@@ -3508,32 +3508,32 @@
 lass='height4',%0A
+
                 
@@ -3606,111 +3606,8 @@
 s',%0A
-                                                                 y_axis_label='Open TCP Socket Count',%0A
     

Remove old keys