Example #1
0
        public virtual StatisticalData[] GetStatisticalData(
            string thresholdName,
            int instanceId,
            DateTime minDateTimeInUtc,
            DateTime maxDateTimeInUtc)
        {
            string str;

            if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
            {
                str = "SELECT AvgResponseTime, [TimeStamp] FROM ResponseTime_CS_Detail WHERE NodeID = @nodeId AND ([TimeStamp] between @start and @end)";
            }
            else if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
            {
                str = "SELECT PercentLoss, [TimeStamp] FROM ResponseTime_CS_Detail WHERE NodeID = @nodeId AND ([TimeStamp] between @start and @end)";
            }
            else if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
            {
                str = "SELECT AvgLoad, [TimeStamp] FROM CPULoad_CS_Detail WHERE NodeID = @nodeId AND ([TimeStamp] between @start and @end)";
            }
            else if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
            {
                str = "SELECT PercentMemoryUsed, [TimeStamp] FROM CPULoad_CS_Detail WHERE NodeID = @nodeId AND ([TimeStamp] between @start and @end)";
            }
            else
            {
                if (!CoreThresholdDataProvider.IsPercentDiskUsed(thresholdName))
                {
                    throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", (object)thresholdName));
                }
                str = "SELECT PercentDiskUsed, [TimeStamp] FROM VolumeUsage_CS_Detail WHERE VolumeID = @instanceId AND ([TimeStamp] between @start and @end)";
            }
            List <StatisticalData> statisticalDataList = new List <StatisticalData>();

            using (SqlConnection connection = DatabaseFunctions.CreateConnection())
            {
                using (SqlCommand textCommand = SqlHelper.GetTextCommand(str))
                {
                    textCommand.Parameters.AddWithValue(nameof(instanceId), (object)instanceId).SqlDbType          = SqlDbType.Int;
                    textCommand.Parameters.AddWithValue("start", (object)minDateTimeInUtc.ToLocalTime()).SqlDbType = SqlDbType.DateTime;
                    textCommand.Parameters.AddWithValue("end", (object)maxDateTimeInUtc.ToLocalTime()).SqlDbType   = SqlDbType.DateTime;
                    using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand, connection))
                    {
                        while (dataReader.Read())
                        {
                            if (!dataReader.IsDBNull(0) && !dataReader.IsDBNull(1))
                            {
                                statisticalDataList.Add(new StatisticalData()
                                {
                                    Value = (__Null)Convert.ToDouble(dataReader[0]),
                                    Date  = (__Null)DatabaseFunctions.GetDateTime(dataReader, 1, DateTimeKind.Local)
                                });
                            }
                        }
                    }
                }
            }
            return(statisticalDataList.ToArray());
        }
        // Token: 0x060004BC RID: 1212 RVA: 0x0001DDF8 File Offset: 0x0001BFF8
        public override StatisticalData[] GetStatisticalData(string thresholdName, int instanceId, DateTime minDateTimeInUtc, DateTime maxDateTimeInUtc)
        {
            string text;

            if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
            {
                text = "SELECT AvgResponseTime, [DateTime] FROM ResponseTime_Detail WHERE NodeID = @nodeId AND ([DateTime] between @start and @end)";
            }
            else if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
            {
                text = "SELECT PercentLoss, [DateTime] FROM ResponseTime_Detail WHERE NodeID = @nodeId AND ([DateTime] between @start and @end)";
            }
            else if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
            {
                text = "SELECT AvgLoad, [DateTime] FROM CPULoad_Detail WHERE NodeID = @nodeId AND ([DateTime] between @start and @end)";
            }
            else
            {
                if (!CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
                {
                    throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", thresholdName));
                }
                text = "SELECT AvgPercentMemoryUsed, [DateTime] FROM CPULoad_Detail WHERE NodeID = @nodeId AND ([DateTime] between @start and @end)";
            }
            List <StatisticalData> list = new List <StatisticalData>();

            using (SqlConnection sqlConnection = DatabaseFunctions.CreateConnection())
            {
                using (SqlCommand textCommand = SqlHelper.GetTextCommand(text))
                {
                    textCommand.Parameters.AddWithValue("nodeId", instanceId).SqlDbType = SqlDbType.Int;
                    textCommand.Parameters.AddWithValue("start", minDateTimeInUtc.ToLocalTime()).SqlDbType = SqlDbType.DateTime;
                    textCommand.Parameters.AddWithValue("end", maxDateTimeInUtc.ToLocalTime()).SqlDbType   = SqlDbType.DateTime;
                    using (IDataReader dataReader = SqlHelper.ExecuteReader(textCommand, sqlConnection))
                    {
                        while (dataReader.Read())
                        {
                            if (!dataReader.IsDBNull(0) && !dataReader.IsDBNull(1))
                            {
                                list.Add(new StatisticalData
                                {
                                    Value = Convert.ToDouble(dataReader[0]),
                                    Date  = DatabaseFunctions.GetDateTime(dataReader, 1, DateTimeKind.Local)
                                });
                            }
                        }
                    }
                }
            }
            return(list.ToArray());
        }
Example #3
0
        public virtual string GetThresholdInstanceName(string thresholdName, int instanceId)
        {
            string str = !CoreThresholdDataProvider.IsPercentDiskUsed(thresholdName) ? "SELECT [Caption] FROM [NodesData] WHERE [NodeId] = @instanceId" : "SELECT [Caption] FROM [Volumes] WHERE [VolumeId] = @instanceId";

            using (SqlConnection connection = DatabaseFunctions.CreateConnection())
            {
                using (SqlCommand textCommand = SqlHelper.GetTextCommand(str))
                {
                    textCommand.Connection = connection;
                    textCommand.Parameters.AddWithValue(nameof(instanceId), (object)instanceId).SqlDbType = SqlDbType.Int;
                    object obj = textCommand.ExecuteScalar();
                    return(obj != null && obj != DBNull.Value ? obj.ToString() : string.Empty);
                }
            }
        }
Example #4
0
        public virtual ThresholdMinMaxValue GetThresholdMinMaxValues(
            string thresholdName,
            int instanceId)
        {
            if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
            {
                ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue();
                thresholdMinMaxValue.set_Min(0.0);
                thresholdMinMaxValue.set_Max(100000.0);
                thresholdMinMaxValue.set_DataType(typeof(int));
                return(thresholdMinMaxValue);
            }
            if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
            {
                ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue();
                thresholdMinMaxValue.set_Min(0.0);
                thresholdMinMaxValue.set_Max(100.0);
                thresholdMinMaxValue.set_DataType(typeof(int));
                return(thresholdMinMaxValue);
            }
            if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
            {
                ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue();
                thresholdMinMaxValue.set_Min(0.0);
                thresholdMinMaxValue.set_Max(100.0);
                thresholdMinMaxValue.set_DataType(typeof(int));
                return(thresholdMinMaxValue);
            }
            if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
            {
                ThresholdMinMaxValue thresholdMinMaxValue = new ThresholdMinMaxValue();
                thresholdMinMaxValue.set_Min(0.0);
                thresholdMinMaxValue.set_Max(100.0);
                thresholdMinMaxValue.set_DataType(typeof(double));
                return(thresholdMinMaxValue);
            }
            if (!CoreThresholdDataProvider.IsPercentDiskUsed(thresholdName))
            {
                throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", (object)thresholdName));
            }
            ThresholdMinMaxValue thresholdMinMaxValue1 = new ThresholdMinMaxValue();

            thresholdMinMaxValue1.set_Min(0.0);
            thresholdMinMaxValue1.set_Max(100.0);
            thresholdMinMaxValue1.set_DataType(typeof(int));
            return(thresholdMinMaxValue1);
        }
 // Token: 0x060004BE RID: 1214 RVA: 0x0001E00C File Offset: 0x0001C20C
 public override string GetStatisticalDataChartName(string thresholdName)
 {
     if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
     {
         return("MinMaxAvgRT");
     }
     if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
     {
         return("PacketLossLine");
     }
     if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
     {
         return("CiscoMMAvgCPULoad");
     }
     if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
     {
         return("HostAvgPercentMemoryUsed");
     }
     throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", thresholdName));
 }
 // Token: 0x060004BB RID: 1211 RVA: 0x0001DCE8 File Offset: 0x0001BEE8
 public override ThresholdMinMaxValue GetThresholdMinMaxValues(string thresholdName, int instanceId)
 {
     if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
     {
         return(new ThresholdMinMaxValue
         {
             Min = 0.0,
             Max = 100000.0,
             DataType = typeof(int)
         });
     }
     if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
     {
         return(new ThresholdMinMaxValue
         {
             Min = 0.0,
             Max = 100.0,
             DataType = typeof(int)
         });
     }
     if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
     {
         return(new ThresholdMinMaxValue
         {
             Min = 0.0,
             Max = 100.0,
             DataType = typeof(int)
         });
     }
     if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
     {
         return(new ThresholdMinMaxValue
         {
             Min = 0.0,
             Max = 100.0,
             DataType = typeof(double)
         });
     }
     throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", thresholdName));
 }
Example #7
0
        public virtual StatisticalTableMetadata GetStatisticalTableMetadata(
            string thresholdName)
        {
            if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
            {
                StatisticalTableMetadata statisticalTableMetadata = new StatisticalTableMetadata();
                statisticalTableMetadata.set_TableName("ResponseTime_Statistics");
                statisticalTableMetadata.set_InstanceIdColumnName("NodeID");
                statisticalTableMetadata.set_MeanColumnName("AvgResponseTimeMean");
                statisticalTableMetadata.set_StdDevColumnName("AvgResponseTimeStDev");
                statisticalTableMetadata.set_MinColumnName("AvgResponseTimeMin");
                statisticalTableMetadata.set_MaxColumnName("AvgResponseTimeMax");
                statisticalTableMetadata.set_CountColumnName("AvgResponseTimeCount");
                statisticalTableMetadata.set_MinDateTime("MinDateTime");
                statisticalTableMetadata.set_MaxDateTime("MaxDateTime");
                statisticalTableMetadata.set_Timestamp("Timestamp");
                return(statisticalTableMetadata);
            }
            if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
            {
                StatisticalTableMetadata statisticalTableMetadata = new StatisticalTableMetadata();
                statisticalTableMetadata.set_TableName("ResponseTime_Statistics");
                statisticalTableMetadata.set_InstanceIdColumnName("NodeID");
                statisticalTableMetadata.set_MeanColumnName("PercentLossMean");
                statisticalTableMetadata.set_StdDevColumnName("PercentLossStDev");
                statisticalTableMetadata.set_MinColumnName("PercentLossMin");
                statisticalTableMetadata.set_MaxColumnName("PercentLossMax");
                statisticalTableMetadata.set_CountColumnName("PercentLossCount");
                statisticalTableMetadata.set_MinDateTime("MinDateTime");
                statisticalTableMetadata.set_MaxDateTime("MaxDateTime");
                statisticalTableMetadata.set_Timestamp("Timestamp");
                return(statisticalTableMetadata);
            }
            if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
            {
                StatisticalTableMetadata statisticalTableMetadata = new StatisticalTableMetadata();
                statisticalTableMetadata.set_TableName("CPULoad_Statistics");
                statisticalTableMetadata.set_InstanceIdColumnName("NodeID");
                statisticalTableMetadata.set_MeanColumnName("AvgLoadMean");
                statisticalTableMetadata.set_StdDevColumnName("AvgLoadStDev");
                statisticalTableMetadata.set_MinColumnName("AvgLoadMin");
                statisticalTableMetadata.set_MaxColumnName("AvgLoadMax");
                statisticalTableMetadata.set_CountColumnName("AvgLoadCount");
                statisticalTableMetadata.set_MinDateTime("MinDateTime");
                statisticalTableMetadata.set_MaxDateTime("MaxDateTime");
                statisticalTableMetadata.set_Timestamp("Timestamp");
                return(statisticalTableMetadata);
            }
            if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
            {
                StatisticalTableMetadata statisticalTableMetadata = new StatisticalTableMetadata();
                statisticalTableMetadata.set_TableName("CPULoad_Statistics");
                statisticalTableMetadata.set_InstanceIdColumnName("NodeID");
                statisticalTableMetadata.set_MeanColumnName("AvgPercentMemoryUsedMean");
                statisticalTableMetadata.set_StdDevColumnName("AvgPercentMemoryUsedStDev");
                statisticalTableMetadata.set_MinColumnName("AvgPercentMemoryUsedMin");
                statisticalTableMetadata.set_MaxColumnName("AvgPercentMemoryUsedMax");
                statisticalTableMetadata.set_CountColumnName("AvgPercentMemoryUsedCount");
                statisticalTableMetadata.set_MinDateTime("MinDateTime");
                statisticalTableMetadata.set_MaxDateTime("MaxDateTime");
                statisticalTableMetadata.set_Timestamp("Timestamp");
                return(statisticalTableMetadata);
            }
            if (!CoreThresholdDataProvider.IsPercentDiskUsed(thresholdName))
            {
                throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", (object)thresholdName));
            }
            StatisticalTableMetadata statisticalTableMetadata1 = new StatisticalTableMetadata();

            statisticalTableMetadata1.set_TableName("VolumeUsage_Statistics");
            statisticalTableMetadata1.set_InstanceIdColumnName("VolumeID");
            statisticalTableMetadata1.set_MeanColumnName("PercentDiskUsedMean");
            statisticalTableMetadata1.set_StdDevColumnName("PercentDiskUsedStDev");
            statisticalTableMetadata1.set_MinColumnName("PercentDiskUsedMin");
            statisticalTableMetadata1.set_MaxColumnName("PercentDiskUsedMax");
            statisticalTableMetadata1.set_CountColumnName("PercentDiskUsedCount");
            statisticalTableMetadata1.set_MinDateTime("MinDateTime");
            statisticalTableMetadata1.set_MaxDateTime("MaxDateTime");
            statisticalTableMetadata1.set_Timestamp("Timestamp");
            return(statisticalTableMetadata1);
        }
 // Token: 0x060004BA RID: 1210 RVA: 0x0001DAD8 File Offset: 0x0001BCD8
 public override StatisticalTableMetadata GetStatisticalTableMetadata(string thresholdName)
 {
     if (CoreThresholdDataProvider.IsResponseTime(thresholdName))
     {
         return(new StatisticalTableMetadata
         {
             TableName = "ResponseTime_Statistics",
             InstanceIdColumnName = "NodeID",
             MeanColumnName = "AvgResponseTimeMean",
             StdDevColumnName = "AvgResponseTimeStDev",
             MinColumnName = "AvgResponseTimeMin",
             MaxColumnName = "AvgResponseTimeMax",
             CountColumnName = "AvgResponseTimeCount",
             MinDateTime = "MinDateTime",
             MaxDateTime = "MaxDateTime",
             Timestamp = "Timestamp"
         });
     }
     if (CoreThresholdDataProvider.IsPercentLoss(thresholdName))
     {
         return(new StatisticalTableMetadata
         {
             TableName = "ResponseTime_Statistics",
             InstanceIdColumnName = "NodeID",
             MeanColumnName = "PercentLossMean",
             StdDevColumnName = "PercentLossStDev",
             MinColumnName = "PercentLossMin",
             MaxColumnName = "PercentLossMax",
             CountColumnName = "PercentLossCount",
             MinDateTime = "MinDateTime",
             MaxDateTime = "MaxDateTime",
             Timestamp = "Timestamp"
         });
     }
     if (CoreThresholdDataProvider.IsCpuLoad(thresholdName))
     {
         return(new StatisticalTableMetadata
         {
             TableName = "CPULoad_Statistics",
             InstanceIdColumnName = "NodeID",
             MeanColumnName = "AvgLoadMean",
             StdDevColumnName = "AvgLoadStDev",
             MinColumnName = "AvgLoadMin",
             MaxColumnName = "AvgLoadMax",
             CountColumnName = "AvgLoadCount",
             MinDateTime = "MinDateTime",
             MaxDateTime = "MaxDateTime",
             Timestamp = "Timestamp"
         });
     }
     if (CoreThresholdDataProvider.IsPercentMemoryUsage(thresholdName))
     {
         return(new StatisticalTableMetadata
         {
             TableName = "CPULoad_Statistics",
             InstanceIdColumnName = "NodeID",
             MeanColumnName = "AvgPercentMemoryUsedMean",
             StdDevColumnName = "AvgPercentMemoryUsedStDev",
             MinColumnName = "AvgPercentMemoryUsedMin",
             MaxColumnName = "AvgPercentMemoryUsedMax",
             CountColumnName = "AvgPercentMemoryUsedCount",
             MinDateTime = "MinDateTime",
             MaxDateTime = "MaxDateTime",
             Timestamp = "Timestamp"
         });
     }
     throw new InvalidOperationException(string.Format("Threshold name '{0}' is not supported.", thresholdName));
 }