From c9803e3f68f8ee30b8d2724ba6e1f6150b4cd643 Mon Sep 17 00:00:00 2001 From: Norm MacLennan Date: Wed, 7 May 2014 16:02:06 -0700 Subject: [PATCH] missing files for settings --- src/NOCQ.Application/settings.json | 37 +++++++++++++++++++++++++++++ src/NOCQ/Settings/PluginSettings.cs | 12 ++++++++++ src/NOCQ/Settings/RedisSettings.cs | 14 +++++++++++ src/NOCQ/Settings/SettingsFIle.cs | 13 ++++++++++ src/NOCQ/Settings/SettingsParser.cs | 12 ++++++++++ 5 files changed, 88 insertions(+) create mode 100644 src/NOCQ.Application/settings.json create mode 100644 src/NOCQ/Settings/PluginSettings.cs create mode 100644 src/NOCQ/Settings/RedisSettings.cs create mode 100644 src/NOCQ/Settings/SettingsFIle.cs create mode 100644 src/NOCQ/Settings/SettingsParser.cs diff --git a/src/NOCQ.Application/settings.json b/src/NOCQ.Application/settings.json new file mode 100644 index 0000000..50f9068 --- /dev/null +++ b/src/NOCQ.Application/settings.json @@ -0,0 +1,37 @@ +{ + Redis: { + hostname: "127.0.0.1", + port: "6379", + timeout: "1000", + inputQueue: "input", + outputQueue: "output" + }, + InputPlugins: [ + { + Name: "Email", + Settings: { + Host: "imap.gmail.com", + Username: "something that's not a real email", + Password: "something that's not a real password", + Port: "993", + Folder: "INBOX", + IsSsl: "true", + Frequency: "10000", + + ParseRules:[{ + + Name: "Nagios", + Enabled: "true", + From: "gwyrox@gmail.com", + Source: "Nagios", + System: "(?<=Host: ).*", + Service: "(?<=Service: ).*", + Data: "(?<=Additional Info:[\\n]*).*", + Runbook: "http://google.com", + Severity: "P3", + + }] + } + } + ] +} diff --git a/src/NOCQ/Settings/PluginSettings.cs b/src/NOCQ/Settings/PluginSettings.cs new file mode 100644 index 0000000..958db17 --- /dev/null +++ b/src/NOCQ/Settings/PluginSettings.cs @@ -0,0 +1,12 @@ +using System; +using System.Dynamic; + +namespace NOCQ +{ + public class PluginSettings + { + public string Name {get;set;} + public dynamic Settings {get;set;} + } +} + diff --git a/src/NOCQ/Settings/RedisSettings.cs b/src/NOCQ/Settings/RedisSettings.cs new file mode 100644 index 0000000..884db5f --- /dev/null +++ b/src/NOCQ/Settings/RedisSettings.cs @@ -0,0 +1,14 @@ +using System; + +namespace NOCQ.Settings +{ + public class RedisSettings + { + public string hostname {get;set;} + public string port {get;set;} + public string timeout{get;set;} + public string inputQueue{get;set;} + public string outputQueue{get;set;} + } +} + diff --git a/src/NOCQ/Settings/SettingsFIle.cs b/src/NOCQ/Settings/SettingsFIle.cs new file mode 100644 index 0000000..bd5297c --- /dev/null +++ b/src/NOCQ/Settings/SettingsFIle.cs @@ -0,0 +1,13 @@ +using System; +using System.Dynamic; +using System.Collections.Generic; + +namespace NOCQ.Settings +{ + public class SettingsFile + { + public RedisSettings Redis { get; set; } + public IEnumerable InputPlugins {get; set; } + } +} + diff --git a/src/NOCQ/Settings/SettingsParser.cs b/src/NOCQ/Settings/SettingsParser.cs new file mode 100644 index 0000000..4951761 --- /dev/null +++ b/src/NOCQ/Settings/SettingsParser.cs @@ -0,0 +1,12 @@ +using System; + +namespace NOCQ.Settings +{ + public class SettingsParser + { + public static SettingsFile Parse(string json){ + return Newtonsoft.Json.JsonConvert.DeserializeObject(json); + } + } +} +