diff --git a/src/NOCQ/NOCQ.csproj b/src/NOCQ/NOCQ.csproj index d0197ea..234fc59 100644 --- a/src/NOCQ/NOCQ.csproj +++ b/src/NOCQ/NOCQ.csproj @@ -58,6 +58,7 @@ ..\..\packages\Newtonsoft.Json.6.0.3\lib\net45\Newtonsoft.Json.dll + monodevelop @@ -71,7 +72,6 @@ - diff --git a/src/NOCQ/Plugins/Email/EmailSettings.cs b/src/NOCQ/Plugins/Email/EmailSettings.cs index e3c8e3b..0a25ad0 100644 --- a/src/NOCQ/Plugins/Email/EmailSettings.cs +++ b/src/NOCQ/Plugins/Email/EmailSettings.cs @@ -12,7 +12,7 @@ namespace NOCQ.Plugins.Email public string Folder {get;set;} public bool IsSsl {get;set;} public int Frequency { get; set; } - public IEnumerable ParseRules {get;set;} + public IEnumerable ParseRules {get;set;} } } diff --git a/src/NOCQ/Plugins/Email/IEmailSetting.cs b/src/NOCQ/Plugins/Email/IEmailSetting.cs index 0ca692b..1e4dfc2 100644 --- a/src/NOCQ/Plugins/Email/IEmailSetting.cs +++ b/src/NOCQ/Plugins/Email/IEmailSetting.cs @@ -11,7 +11,7 @@ namespace NOCQ.Plugins.Email string Folder {get;set;} bool IsSsl {get;set;} int Frequency { get; set; } - IEnumerable ParseRules {get;set;} + IEnumerable ParseRules {get;set;} } } diff --git a/src/NOCQ/Plugins/Email/IParseRule.cs b/src/NOCQ/Plugins/Email/IParseRule.cs deleted file mode 100644 index 4d0eedb..0000000 --- a/src/NOCQ/Plugins/Email/IParseRule.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace NOCQ.Plugins.Email -{ - public interface IParseRule - { - string Name { get; set; } - bool Enabled { get; set; } - string From {get;set;} - string Source {get;set;} - string System {get;set;} - string Service {get;set;} - string Data {get;set;} - string Runbook { get; set;} - string Severity {get;set;} - } -} - diff --git a/src/NOCQ/Plugins/Email/ImapInput.cs b/src/NOCQ/Plugins/Email/ImapInput.cs index 2011af1..45a579b 100644 --- a/src/NOCQ/Plugins/Email/ImapInput.cs +++ b/src/NOCQ/Plugins/Email/ImapInput.cs @@ -17,7 +17,7 @@ namespace NOCQ.Plugins.Email int port { get; set; } bool ssl { get; set; } DateTime lastRun { get; set; } - List parseRules{ get; set; } + IEnumerable parseRules{ get; set; } public ImapInput (dynamic settings) { @@ -43,13 +43,15 @@ namespace NOCQ.Plugins.Email timer.Elapsed += Execute; } - public void Execute(object sender, ElapsedEventArgs args) + private List getAlerts() { + var alerts = new List (); + using(var imap = new ImapClient(server, loginName, password, ImapClient.AuthMethods.Login, 993, true)) { var msgs = imap.SearchMessages( SearchCondition.Undeleted().And( - SearchCondition.SentSince(new DateTime(2014, 5, 7)) - )); + SearchCondition.SentSince(new DateTime(2014, 5, 7)) + )); foreach (var msg in msgs) { @@ -73,16 +75,23 @@ namespace NOCQ.Plugins.Email Console.WriteLine ("Source: " + source); Console.WriteLine("System: " + sysMatch.Value); Console.WriteLine ("Service: " + servMatch.Value); + + alerts.Add (new Alert () { + Source = source, + System = sysMatch.Value, + Service = servMatch.Value + }); } - - - - //Console.WriteLine (system); } } } } + public void Execute(object sender, ElapsedEventArgs args) + { + + } + public void Run() { Console.WriteLine ("Start"); diff --git a/src/NOCQ/Plugins/Email/ParseRule.cs b/src/NOCQ/Plugins/Email/ParseRule.cs index 7c89b42..a67b10f 100644 --- a/src/NOCQ/Plugins/Email/ParseRule.cs +++ b/src/NOCQ/Plugins/Email/ParseRule.cs @@ -2,7 +2,7 @@ using System; namespace NOCQ.Plugins.Email { - public class ParseRule : IParseRule + public class ParseRule { public string Name { get; set; } public bool Enabled { get; set; }