diff --git a/pydashie/assets/stylesheets/application.css b/pydashie/assets/stylesheets/application.css index 35eab99..56a7368 100644 --- a/pydashie/assets/stylesheets/application.css +++ b/pydashie/assets/stylesheets/application.css @@ -122,24 +122,17 @@ font-size: 20px; font-weight: bold; text-transform: uppercase; } - p .widget-nagios li.updated-at { - font-size: 10px; } - .widget-nagios li.green { - background-color: #86d751; } - .widget-nagios li.green p.updated-at { - color: #c0eaa4; } - .widget-nagios li.yellow { - background-color: #edde43; } - .widget-nagios li.yellow p.updated-at { - color: #f6eea0; } - .widget-nagios li.red { - background-color: #e3394f; } - .widget-nagios li.red p.updated-at { - color: #f0929e; } - .widget-nagios li.error { - background-color: #f75f00; } - .widget-nagios li.error p.updated-at { - color: #ff9c5e; } + .widget-nagios li p.updated-at { + color: rgba(0, 0, 0, 0.6); + font-size: 0.8em; } + .widget-nagios li.green { + background-color: #86d751; } + .widget-nagios li.yellow { + background-color: #edde43; } + .widget-nagios li.red { + background-color: #e3394f; } + .widget-nagios li.error { + background-color: #f75f00; } .widget-usage-gauge { background-color: #ec223f; } @@ -268,6 +261,38 @@ .widget-number .updated-at { color: rgba(0, 0, 0, 0.3); } +.widget-nagios-list { + background-color: #5B7F97; + vertical-align: top; } + .widget-nagios-list .title { + color: rgba(255, 255, 255, 0.7); + font-size: 1em; } + .widget-nagios-list .subtitle { + color: rgba(255, 255, 255, 0.7); + font-size: 0.8em; } + .widget-nagios-list ol, .widget-nagios-list ul { + margin: 0 15px; + text-align: left; + color: rgba(255, 255, 255, 0.7); } + .widget-nagios-list ol { + nagios-list-style-position: inside; } + .widget-nagios-list li { + margin-bottom: 5px; } + .widget-nagios-list .nagios-list-nostyle { + nagios-list-style: none; } + .widget-nagios-list .label { + color: rgba(255, 255, 255, 0.7); } + .widget-nagios-list .value { + float: right; + margin-left: 12px; + font-weight: 600; + color: #fff; } + .widget-nagios-list .updated-at { + color: rgba(0, 0, 0, 0.6); + font-size: 0.8em; } + .widget-nagios-list .more-info { + color: rgba(255, 255, 255, 0.7); } + @-webkit-keyframes status-warning-background { 0% { background-color: #e82711; } diff --git a/pydashie/example_app.py b/pydashie/example_app.py index a6b793e..9fff7e6 100644 --- a/pydashie/example_app.py +++ b/pydashie/example_app.py @@ -4,7 +4,7 @@ from example_samplers import ( RegionsRAMSampler, RegionsCPUSampler, NagiosSampler, - # BuzzwordsSampler, + NagiosRegionSampler, # ConvergenceSampler, ) @@ -12,12 +12,12 @@ from example_samplers import ( def run(args, conf, app, xyzzy): samplers = [ - CPUSampler(xyzzy, 10, conf['openstack']), - RAMSampler(xyzzy, 10, conf['openstack']), - RegionsCPUSampler(xyzzy, 10, conf['openstack']), - RegionsRAMSampler(xyzzy, 10, conf['openstack']), - NagiosSampler(xyzzy, 10, conf['nagios']), - # BuzzwordsSampler(xyzzy, 2), + CPUSampler(xyzzy, 60, conf['openstack']), + RAMSampler(xyzzy, 60, conf['openstack']), + RegionsCPUSampler(xyzzy, 60, conf['openstack']), + RegionsRAMSampler(xyzzy, 60, conf['openstack']), + NagiosSampler(xyzzy, 5, conf['nagios']), + NagiosRegionSampler(xyzzy, 5, conf['nagios']), # ConvergenceSampler(xyzzy, 1), ] diff --git a/pydashie/example_samplers.py b/pydashie/example_samplers.py index a57eff1..114f827 100644 --- a/pydashie/example_samplers.py +++ b/pydashie/example_samplers.py @@ -181,21 +181,24 @@ class NagiosSampler(DashieSampler): return s -class BuzzwordsSampler(DashieSampler): +class NagiosRegionSampler(DashieSampler): def name(self): - return 'buzzwords' + return 'nagios_regions' def sample(self): - my_little_pony_names = ['Rainbow Dash', - 'Blossomforth', - 'Derpy', - 'Fluttershy', - 'Lofty', - 'Scootaloo', - 'Skydancer'] - items = [{'label': pony_name, 'value': random.randint(0, 20)} for pony_name in my_little_pony_names] - random.shuffle(items) - return {'items': items} + nagios.get_statusfiles(self._conf['services']) + servicestatus = nagios.parse_status(self._conf['services']) + + criticals = [] + warnings = [] + + for region in servicestatus: + criticals.append({'label': region, + 'value': servicestatus[region]['critical']}) + warnings.append({'label': region, + 'value': servicestatus[region]['warning']}) + + return {'criticals': criticals, 'warnings': warnings} class ConvergenceSampler(DashieSampler): diff --git a/pydashie/main.py b/pydashie/main.py index daeff79..8c2512e 100644 --- a/pydashie/main.py +++ b/pydashie/main.py @@ -58,6 +58,7 @@ def javascripts(): 'widgets/progress_bars/progress_bars.coffee', 'widgets/usage_gauge/usage_gauge.coffee', 'widgets/nagios/nagios.coffee', + 'widgets/nagios_list/nagios_list.coffee', ] nizzle = True if not nizzle: diff --git a/pydashie/templates/main.html b/pydashie/templates/main.html index 92dab81..53996ec 100644 --- a/pydashie/templates/main.html +++ b/pydashie/templates/main.html @@ -20,16 +20,20 @@
diff --git a/pydashie/widgets/nagios/nagios.scss b/pydashie/widgets/nagios/nagios.scss index d41ba46..0499ccb 100644 --- a/pydashie/widgets/nagios/nagios.scss +++ b/pydashie/widgets/nagios/nagios.scss @@ -25,48 +25,27 @@ $error: #f75f00; text-transform: uppercase; } - p &.updated-at { - font-size: 10px; + p { + &.updated-at { + color: rgba(0, 0, 0, 0.6); + font-size: 0.8em; + } } &.green { background-color: $success; - - p { - &.updated-at { - color: lighten($success, 20%); - } - } } &.yellow { background-color: $warning; - - p { - &.updated-at { - color: lighten($warning, 20%); - } - } } &.red { background-color: $failure; - - p { - &.updated-at { - color: lighten($failure, 20%); - } - } } &.error { background-color: $error; - - p { - &.updated-at { - color: lighten($error, 20%); - } - } } } } diff --git a/pydashie/widgets/nagios_list/nagios_list.coffee b/pydashie/widgets/nagios_list/nagios_list.coffee new file mode 100644 index 0000000..b7ce2e0 --- /dev/null +++ b/pydashie/widgets/nagios_list/nagios_list.coffee @@ -0,0 +1 @@ +class Dashing.NagiosList extends Dashing.Widget \ No newline at end of file diff --git a/pydashie/widgets/nagios_list/nagios_list.html b/pydashie/widgets/nagios_list/nagios_list.html new file mode 100644 index 0000000..caf787e --- /dev/null +++ b/pydashie/widgets/nagios_list/nagios_list.html @@ -0,0 +1,22 @@ +

+ +

+ + + +

+ + + +

+

diff --git a/pydashie/widgets/nagios_list/nagios_list.scss b/pydashie/widgets/nagios_list/nagios_list.scss new file mode 100644 index 0000000..a6edd41 --- /dev/null +++ b/pydashie/widgets/nagios_list/nagios_list.scss @@ -0,0 +1,67 @@ +// ---------------------------------------------------------------------------- +// Sass declarations +// ---------------------------------------------------------------------------- +$background-color: #5B7F97; +$value-color: #fff; + +$title-color: rgba(255, 255, 255, 0.7); +$label-color: rgba(255, 255, 255, 0.7); +$moreinfo-color: rgba(255, 255, 255, 0.7); + +// ---------------------------------------------------------------------------- +// Widget-nagios-list styles +// ---------------------------------------------------------------------------- +.widget-nagios-list { + + background-color: $background-color; + vertical-align: top; + + .title { + color: $title-color; + font-size: 1em; + } + + .subtitle { + color: $title-color; + font-size: 0.8em; + } + + ol, ul { + margin: 0 15px; + text-align: left; + color: $label-color; + } + + ol { + nagios-list-style-position: inside; + } + + li { + margin-bottom: 5px; + } + + .nagios-list-nostyle { + nagios-list-style: none; + } + + .label { + color: $label-color; + } + + .value { + float: right; + margin-left: 12px; + font-weight: 600; + color: $value-color; + } + + .updated-at { + color: rgba(0, 0, 0, 0.6); + font-size: 0.8em; + } + + .more-info { + color: $moreinfo-color; + } + +} \ No newline at end of file