Example #1
0
 public void Alert(Collider collider, string tag, AlertSeverity severity)
 {
     if (!collider.gameObject.GetComponentInParent <Agent>())
     {
         return;
     }
     towerAlerts[tag].GetComponent <Blinker>()?.StartBlinking(severity);
 }
Example #2
0
 protected Alert(
     DateTime time,
     AlertSeverity severity,
     AlertStatus status)
     : this(
         time,
         time,
         severity,
         status)
 {
 }
Example #3
0
 protected Alert(
     DateTime startTime,
     DateTime endTime,
     AlertSeverity severity,
     AlertStatus status)
 {
     Id        = ObjectId.GenerateNewId();
     StartTime = startTime;
     EndTime   = endTime;
     IsVisible = true;
     Severity  = severity;
     Status    = status;
 }
        internal static string ToSerializedValue(this AlertSeverity value)
        {
            switch (value)
            {
            case AlertSeverity.Informational:
                return("Informational");

            case AlertSeverity.Warning:
                return("Warning");

            case AlertSeverity.Critical:
                return("Critical");
            }
            return(null);
        }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the Alert class.
 /// </summary>
 /// <param name="title">The title of the alert</param>
 /// <param name="scope">The scope of the alert. Possible values
 /// include: 'Resource', 'Device'</param>
 /// <param name="alertType">The type of the alert</param>
 /// <param name="appearedAtTime">The UTC time at which the alert was
 /// raised</param>
 /// <param name="appearedAtSourceTime">The source time at which the
 /// alert was raised</param>
 /// <param name="source">The source at which the alert was
 /// raised</param>
 /// <param name="severity">The severity of the alert. Possible values
 /// include: 'Informational', 'Warning', 'Critical'</param>
 /// <param name="status">The current status of the alert. Possible
 /// values include: 'Active', 'Cleared'</param>
 /// <param name="id">The path ID that uniquely identifies the
 /// object.</param>
 /// <param name="name">The name of the object.</param>
 /// <param name="type">The hierarchical type of the object.</param>
 /// <param name="kind">The Kind of the object. Currently only
 /// Series8000 is supported. Possible values include:
 /// 'Series8000'</param>
 /// <param name="clearedAtTime">The UTC time at which the alert was
 /// cleared</param>
 /// <param name="clearedAtSourceTime">The source time at which the
 /// alert was cleared</param>
 /// <param name="recommendation">The recommended action for the issue
 /// raised in the alert</param>
 /// <param name="resolutionReason">The reason for resolving the
 /// alert</param>
 /// <param name="errorDetails">The details of the error for which the
 /// alert was raised</param>
 /// <param name="detailedInformation">More details about the
 /// alert</param>
 public Alert(string title, AlertScope scope, string alertType, System.DateTime appearedAtTime, System.DateTime appearedAtSourceTime, AlertSource source, AlertSeverity severity, AlertStatus status, string id = default(string), string name = default(string), string type = default(string), Kind?kind = default(Kind?), System.DateTime?clearedAtTime = default(System.DateTime?), System.DateTime?clearedAtSourceTime = default(System.DateTime?), string recommendation = default(string), string resolutionReason = default(string), AlertErrorDetails errorDetails = default(AlertErrorDetails), IDictionary <string, string> detailedInformation = default(IDictionary <string, string>))
     : base(id, name, type, kind)
 {
     Title                = title;
     Scope                = scope;
     AlertType            = alertType;
     AppearedAtTime       = appearedAtTime;
     AppearedAtSourceTime = appearedAtSourceTime;
     ClearedAtTime        = clearedAtTime;
     ClearedAtSourceTime  = clearedAtSourceTime;
     Source               = source;
     Recommendation       = recommendation;
     ResolutionReason     = resolutionReason;
     Severity             = severity;
     Status               = status;
     ErrorDetails         = errorDetails;
     DetailedInformation  = detailedInformation;
 }
Example #6
0
        public AlertModel(string title, string message, AlertSeverity severity)
        {
            Title       = title;
            Message     = message;
            Severity    = severity;
            DateCreated = DateTimeOffset.Now;

            _closingTimer = new Timer(5000);
            _closingTimer.Start();
            _closingTimer.Elapsed += (sender, args) =>
            {
                HasElapsed = true;
                _closeTimer.Start();
            };

            _closeTimer          = new Timer(1000);
            _closeTimer.Elapsed += (sender, args) => Elapsed();
        }
Example #7
0
        public AlertModel(string title, string message, AlertSeverity severity)
        {
            Title = title;
            Message = message;
            Severity = severity;
            DateCreated = DateTimeOffset.Now;

            _closingTimer = new Timer(5000);
            _closingTimer.Start();
            _closingTimer.Elapsed += (sender, args) =>
            {
                HasElapsed = true;
                _closeTimer.Start();
            };

            _closeTimer = new Timer(1000);
            _closeTimer.Elapsed += (sender, args) => Elapsed();
        }
        private IPage <Alert> GetAlertsBySeverity(AlertSeverity severity)
        {
            var minTime = TestConstants.MinTimeForAlert;
            var maxTime = TestConstants.MaxTimeForAlert;

            Expression <Func <AlertFilter, bool> > filterExp = filter =>
                                                               filter.AppearedOnTime >= minTime &&
                                                               filter.AppearedOnTime <= maxTime &&
                                                               filter.Severity == severity;

            var alertFilters = new ODataQuery <AlertFilter>(filterExp);

            alertFilters.Top = 100;

            var alerts = GetAlertsByFilters(alertFilters);

            Assert.True(alerts.Any(), "No Alerts found");

            return(alerts);
        }
Example #9
0
        private static MessageBoxImage SelectImage(AlertSeverity severity)
        {
            switch (severity)
            {
            case AlertSeverity.None:
                return(MessageBoxImage.None);

            case AlertSeverity.Info:
                return(MessageBoxImage.Information);

            case AlertSeverity.Warning:
                return(MessageBoxImage.Warning);

            case AlertSeverity.Error:
                return(MessageBoxImage.Error);

            default:
                throw new ArgumentOutOfRangeException(nameof(severity), severity, null);
            }
        }
Example #10
0
        /// <summary>
        /// Sends an SNMPAlert message with application name, severity level and a message 
        /// string.
        /// </summary>
        /// <param name="application">The application name which sends an alert message.</param>
        /// <param name="severity">The level of alert severity.</param>
        /// <param name="message">A string that contains the error message.</param>
        /// <returns> Returns true if successfully sends the message otherwise returns false.</returns>
        public bool Send(string application, AlertSeverity severity, string message)
        {
            bool bReturnValue = false;
            try
            {
                // build the message string
                string tmp = String.Format("OCM {0} {1} 0 {2}", application, (char)(byte)severity, message);

                // call the CATRAP exe
                Process.Start(m_path, m_arguments + "\"" + tmp + "\"");

                // success if we get this far
                bReturnValue = true;
            }
            catch (Exception ex)
            {
                m_errorLog.Write(0, "SNMPAlert", "Sending SNMP alert failed: " + ex.Message
                    + " app message: " + message, LogLevel.Error);
            }
            return bReturnValue;
        }
        public static void AddAlert(this HttpContext httpContext, string name, string message, AlertSeverity severity)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException(nameof(httpContext));
            }

            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }

            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException(nameof(name));
            }

            if (message == null)
            {
                throw new ArgumentNullException(nameof(message));
            }

            var messageKey  = $"{AlertMessagePrefix}{name.ToLower()}";
            var severityKey = $"{AlertSeverityPrefix}{name.ToLower()}";

            if (httpContext.Session.Keys.Contains(messageKey))
            {
                httpContext.Session.Remove(messageKey);
            }

            if (httpContext.Session.Keys.Contains(severityKey))
            {
                httpContext.Session.Remove(severityKey);
            }

            httpContext.Session.SetString(messageKey, message);
            httpContext.Session.SetInt32(severityKey, (int)severity);
        }
        public async Task SavedSearchesProperties()
        {
            using (var service = await SdkHelper.CreateService())
            {
                SavedSearchCollection savedSearches = service.SavedSearches;
                await savedSearches.GetAllAsync();

                // Iterate saved searches and make sure we can read them

                foreach (SavedSearch savedSearch in savedSearches)
                {
                    string dummyString;
                    bool   dummyBool;
                    //DateTime dummyDateTime;
                    int dummyInt;

                    // Resource properties
                    //dummyString = savedSearch.Name;
                    dummyString = savedSearch.Name;
                    //dummyString = savedSearch.Path;
                    // SavedSearch properties get
                    dummyString = savedSearch.Actions.Email.AuthPassword;
                    dummyString = savedSearch.Actions.Email.AuthUsername;
                    dummyBool   = savedSearch.Actions.Email.SendResults;
                    dummyString = savedSearch.Actions.Email.Bcc;
                    dummyString = savedSearch.Actions.Email.CC;
                    dummyString = savedSearch.Actions.Email.Command;
                    EmailFormat emailFormat = savedSearch.Actions.Email.Format;
                    dummyBool   = savedSearch.Actions.Email.Inline;
                    dummyString = savedSearch.Actions.Email.MailServer;
                    dummyInt    = savedSearch.Actions.Email.MaxResults;
                    dummyString = savedSearch.Actions.Email.MaxTime;
                    PaperOrientation paperOrientation = savedSearch.Actions.Email.ReportPaperOrientation;
                    PaperSize        paperSize        = savedSearch.Actions.Email.ReportPaperSize;
                    dummyBool = savedSearch.Actions.Email.ReportServerEnabled;
                    //dummyString = savedSearch.Actions.Email.ReportServerUrl;
                    dummyBool   = savedSearch.Actions.Email.SendPdf;
                    dummyBool   = savedSearch.Actions.Email.SendResults;
                    dummyString = savedSearch.Actions.Email.Subject;
                    dummyString = savedSearch.Actions.Email.To;
                    dummyBool   = savedSearch.Actions.Email.TrackAlert;
                    dummyString = savedSearch.Actions.Email.Ttl;
                    dummyBool   = savedSearch.Actions.Email.UseSsl;
                    dummyBool   = savedSearch.Actions.Email.UseTls;
                    dummyBool   = savedSearch.Actions.Email.WidthSortColumns;
                    dummyString = savedSearch.Actions.PopulateLookup.Command;
                    dummyString = savedSearch.Actions.PopulateLookup.Destination;
                    dummyString = savedSearch.Actions.PopulateLookup.Hostname;
                    dummyInt    = savedSearch.Actions.PopulateLookup.MaxResults;
                    dummyString = savedSearch.Actions.PopulateLookup.MaxTime;
                    dummyBool   = savedSearch.Actions.PopulateLookup.TrackAlert;
                    dummyString = savedSearch.Actions.PopulateLookup.Ttl;
                    dummyString = savedSearch.Actions.Rss.Command;
                    //dummyString = savedSearch.Actions.Rss.Hostname;
                    dummyInt    = savedSearch.Actions.Rss.MaxResults;
                    dummyString = savedSearch.Actions.Rss.MaxTime;
                    dummyBool   = savedSearch.Actions.Rss.TrackAlert;
                    dummyString = savedSearch.Actions.Rss.Ttl;
                    SavedSearch.ActionsAdapter.ScriptAdapter scriptT = savedSearch.Actions.Script;
                    dummyString = scriptT.FileName;
                    dummyString = scriptT.Hostname;
                    dummyInt    = scriptT.MaxResults;
                    dummyString = scriptT.MaxTime;
                    dummyBool   = scriptT.TrackAlert;
                    dummyString = scriptT.Ttl;
                    dummyString = savedSearch.Actions.SummaryIndex.Name;
                    dummyString = savedSearch.Actions.SummaryIndex.Command;
                    //dummyString = savedSearch.Actions.SummaryIndex.Hostname;
                    dummyBool   = savedSearch.Actions.SummaryIndex.Inline;
                    dummyInt    = savedSearch.Actions.SummaryIndex.MaxResults;
                    dummyString = savedSearch.Actions.SummaryIndex.MaxTime;
                    dummyBool   = savedSearch.Actions.SummaryIndex.TrackAlert;
                    dummyString = savedSearch.Actions.SummaryIndex.Ttl;
                    dummyBool   = savedSearch.Alert.DigestMode;
                    dummyString = savedSearch.Alert.Expires;
                    AlertSeverity alertSeverity = savedSearch.Alert.Severity;
                    SavedSearch.AlertAdapter.SuppressAdapter suppress = savedSearch.Alert.Suppress;
                    dummyString = suppress.Fields;
                    dummyString = suppress.Period;
                    AlertTrack      track      = savedSearch.Alert.Track;
                    AlertComparator comparator = savedSearch.Alert.Comparator;
                    dummyString = savedSearch.Alert.Condition;
                    dummyString = savedSearch.Alert.Threshold;
                    AlertType alertType = savedSearch.Alert.AlertType;
                    dummyString = savedSearch.CronSchedule;
                    dummyString = savedSearch.Description;
                    dummyInt    = savedSearch.Dispatch.Buckets;
                    dummyString = savedSearch.Dispatch.EarliestTime;
                    //dummyString = savedSearch.Dispatch.LatestTime;
                    dummyBool   = savedSearch.Dispatch.Lookups;
                    dummyInt    = savedSearch.Dispatch.MaxCount;
                    dummyInt    = savedSearch.Dispatch.MaxTime;
                    dummyInt    = savedSearch.Dispatch.ReduceFreq;
                    dummyBool   = savedSearch.Dispatch.RealTimeBackfill;
                    dummyBool   = savedSearch.Dispatch.SpawnProcess;
                    dummyString = savedSearch.Dispatch.TimeFormat;
                    dummyString = savedSearch.Dispatch.Ttl;
                    SavedSearch.DisplayAdapter display = savedSearch.Display;
                    dummyInt = savedSearch.MaxConcurrent;
                    //dummyDateTime = savedSearch.NextScheduledTime;
                    dummyString = savedSearch.QualifiedSearch;
                    dummyBool   = savedSearch.RealTimeSchedule;
                    dummyString = savedSearch.Request.UIDispatchApp;
                    dummyString = savedSearch.Request.UIDispatchView;
                    dummyBool   = savedSearch.RestartOnSearchPeerAdd;
                    dummyBool   = savedSearch.RunOnStartup;
                    dummyString = savedSearch.Search;
                    //dummyString = savedSearch.Vsid;
                    dummyBool = savedSearch.Actions.Email.IsEnabled;
                    dummyBool = savedSearch.Actions.PopulateLookup.IsEnabled;
                    dummyBool = savedSearch.Actions.Rss.IsEnabled;
                    //dummyBool = savedSearch.IsActionScript;
                    dummyBool = savedSearch.Actions.SummaryIndex.IsEnabled;
                    dummyBool = savedSearch.IsDisabled;
                    dummyBool = savedSearch.IsScheduled;
                    dummyBool = savedSearch.IsVisible;
                }

                for (int i = 0; i < savedSearches.Count; i++)
                {
                    SavedSearch savedSearch = savedSearches[i];

                    string dummyString;
                    bool   dummyBool;
                    //DateTime dummyDateTime;
                    int dummyInt;

                    // Resource properties
                    //dummyString = savedSearch.Name;
                    dummyString = savedSearch.Name;
                    //dummyString = savedSearch.Path;
                    // SavedSearch properties get
                    dummyString = savedSearch.Actions.Email.AuthPassword;
                    dummyString = savedSearch.Actions.Email.AuthUsername;
                    dummyBool   = savedSearch.Actions.Email.SendResults;
                    dummyString = savedSearch.Actions.Email.Bcc;
                    dummyString = savedSearch.Actions.Email.CC;
                    dummyString = savedSearch.Actions.Email.Command;
                    EmailFormat emailFormat = savedSearch.Actions.Email.Format;
                    dummyBool   = savedSearch.Actions.Email.Inline;
                    dummyString = savedSearch.Actions.Email.MailServer;
                    dummyInt    = savedSearch.Actions.Email.MaxResults;
                    dummyString = savedSearch.Actions.Email.MaxTime;
                    PaperOrientation paperOrientation = savedSearch.Actions.Email.ReportPaperOrientation;
                    PaperSize        paperSize        = savedSearch.Actions.Email.ReportPaperSize;
                    dummyBool = savedSearch.Actions.Email.ReportServerEnabled;
                    //dummyString = savedSearch.Actions.Email.ReportServerUrl;
                    dummyBool   = savedSearch.Actions.Email.SendPdf;
                    dummyBool   = savedSearch.Actions.Email.SendResults;
                    dummyString = savedSearch.Actions.Email.Subject;
                    dummyString = savedSearch.Actions.Email.To;
                    dummyBool   = savedSearch.Actions.Email.TrackAlert;
                    dummyString = savedSearch.Actions.Email.Ttl;
                    dummyBool   = savedSearch.Actions.Email.UseSsl;
                    dummyBool   = savedSearch.Actions.Email.UseTls;
                    dummyBool   = savedSearch.Actions.Email.WidthSortColumns;
                    dummyString = savedSearch.Actions.PopulateLookup.Command;
                    dummyString = savedSearch.Actions.PopulateLookup.Destination;
                    dummyString = savedSearch.Actions.PopulateLookup.Hostname;
                    dummyInt    = savedSearch.Actions.PopulateLookup.MaxResults;
                    dummyString = savedSearch.Actions.PopulateLookup.MaxTime;
                    dummyBool   = savedSearch.Actions.PopulateLookup.TrackAlert;
                    dummyString = savedSearch.Actions.PopulateLookup.Ttl;
                    dummyString = savedSearch.Actions.Rss.Command;
                    //dummyString = savedSearch.Actions.Rss.Hostname;
                    dummyInt    = savedSearch.Actions.Rss.MaxResults;
                    dummyString = savedSearch.Actions.Rss.MaxTime;
                    dummyBool   = savedSearch.Actions.Rss.TrackAlert;
                    dummyString = savedSearch.Actions.Rss.Ttl;
                    SavedSearch.ActionsAdapter.ScriptAdapter script = savedSearch.Actions.Script;
                    dummyString = script.FileName;
                    dummyString = script.Hostname;
                    dummyInt    = script.MaxResults;
                    dummyString = script.MaxTime;
                    dummyBool   = script.TrackAlert;
                    dummyString = script.Ttl;
                    dummyString = savedSearch.Actions.SummaryIndex.Name;
                    dummyString = savedSearch.Actions.SummaryIndex.Command;
                    //dummyString = savedSearch.Actions.SummaryIndex.Hostname;
                    dummyBool   = savedSearch.Actions.SummaryIndex.Inline;
                    dummyInt    = savedSearch.Actions.SummaryIndex.MaxResults;
                    dummyString = savedSearch.Actions.SummaryIndex.MaxTime;
                    dummyBool   = savedSearch.Actions.SummaryIndex.TrackAlert;
                    dummyString = savedSearch.Actions.SummaryIndex.Ttl;
                    dummyBool   = savedSearch.Alert.DigestMode;
                    dummyString = savedSearch.Alert.Expires;
                    AlertSeverity alertSeverity = savedSearch.Alert.Severity;
                    SavedSearch.AlertAdapter.SuppressAdapter suppress = savedSearch.Alert.Suppress;
                    dummyString = suppress.Fields;
                    dummyString = suppress.Period;
                    AlertTrack      track      = savedSearch.Alert.Track;
                    AlertComparator comparator = savedSearch.Alert.Comparator;
                    dummyString = savedSearch.Alert.Condition;
                    dummyString = savedSearch.Alert.Threshold;
                    AlertType alertType = savedSearch.Alert.AlertType;
                    dummyString = savedSearch.CronSchedule;
                    dummyString = savedSearch.Description;
                    dummyInt    = savedSearch.Dispatch.Buckets;
                    dummyString = savedSearch.Dispatch.EarliestTime;
                    //dummyString = savedSearch.Dispatch.LatestTime;
                    dummyBool   = savedSearch.Dispatch.Lookups;
                    dummyInt    = savedSearch.Dispatch.MaxCount;
                    dummyInt    = savedSearch.Dispatch.MaxTime;
                    dummyInt    = savedSearch.Dispatch.ReduceFreq;
                    dummyBool   = savedSearch.Dispatch.RealTimeBackfill;
                    dummyBool   = savedSearch.Dispatch.SpawnProcess;
                    dummyString = savedSearch.Dispatch.TimeFormat;
                    dummyString = savedSearch.Dispatch.Ttl;
                    SavedSearch.DisplayAdapter display = savedSearch.Display;
                    dummyInt = savedSearch.MaxConcurrent;
                    //dummyDateTime = savedSearch.NextScheduledTime;
                    dummyString = savedSearch.QualifiedSearch;
                    dummyBool   = savedSearch.RealTimeSchedule;
                    dummyString = savedSearch.Request.UIDispatchApp;
                    dummyString = savedSearch.Request.UIDispatchView;
                    dummyBool   = savedSearch.RestartOnSearchPeerAdd;
                    dummyBool   = savedSearch.RunOnStartup;
                    dummyString = savedSearch.Search;
                    //dummyString = savedSearch.Vsid;
                    dummyBool = savedSearch.Actions.Email.IsEnabled;
                    dummyBool = savedSearch.Actions.PopulateLookup.IsEnabled;
                    dummyBool = savedSearch.Actions.Rss.IsEnabled;
                    //dummyBool = savedSearch.IsActionScript;
                    dummyBool = savedSearch.Actions.SummaryIndex.IsEnabled;
                    dummyBool = savedSearch.IsDisabled;
                    dummyBool = savedSearch.IsScheduled;
                    dummyBool = savedSearch.IsVisible;
                }
            }
        }
Example #13
0
 public AlertMessage(string title, string message, AlertSeverity severity)
 {
     Alert = new AlertModel(title, message, severity);
 }
Example #14
0
 public AlertMessage(string title, string message, AlertSeverity severity)
 {
     Alert = new AlertModel(title, message, severity);
 }
Example #15
0
 private AlertOptions(AlertSeverity type, string title, string message)
 {
     Type    = type;
     Title   = title;
     Message = message;
 }