/// <summary>
        /// 根据订阅ID查询eSight
        /// </summary>
        /// <param name="subscribeId">The subscribe identifier.</param>
        /// <returns>Huawei.SCOM.ESightPlugin.Models.HWESightHost.</returns>
        public HWESightHost GetEntityBySubscribeId(string subscribeId)
        {
            IObjectReader <EnterpriseManagementObject> items =
                OM12Connection.Query <EnterpriseManagementObject>(ESightAppliance.EntityClassName, $"SubscribeID='{subscribeId}'");

            return(items.Select(ConvertMonitoringObjectToESightHost()).FirstOrDefault());
        }
        /// <summary>
        /// 根据IP查找ESight实体。
        /// </summary>
        /// <param name="hostIp">The host ip.</param>
        /// <returns>The <see cref="HWESightHost" />.</returns>
        public HWESightHost GetEntityByHostIp(string hostIp)
        {
            IObjectReader <EnterpriseManagementObject> items =
                OM12Connection.Query <EnterpriseManagementObject>(ESightAppliance.EntityClassName, $"Host='{hostIp}'");

            return(items.Select(ConvertMonitoringObjectToESightHost()).FirstOrDefault());
        }
        public void InsertAlert()
        {
            var eSightHost            = "192.168.0.2";
            var objects               = OM12Connection.Query <PartialMonitoringObject>(ESightAppliance.EntityClassName, $"Host='{eSightHost}'");
            PartialMonitoringObject p = (PartialMonitoringObject)objects.First();

            //OM12Connection.HuaweiESightMG.GetMonitoringAlert();
        }
        /// <summary>
        /// Updates  esight connect status.
        /// </summary>
        /// <param name="hostIp">The host ip.</param>
        /// <param name="latestStatus">The latest status.</param>
        /// <param name="latestConnectInfo">The latest connect information.</param>
        public void UpdateESightConnectStatus(string hostIp, string latestStatus, string latestConnectInfo)
        {
            IObjectReader <EnterpriseManagementObject> items =
                OM12Connection.Query <EnterpriseManagementObject>(ESightAppliance.EntityClassName, $"Host='{hostIp}'");
            EnterpriseManagementObject managementObject = items.FirstOrDefault();

            if (managementObject == null)
            {
                throw new Exception($"Can not find the eSight:{hostIp}");
            }

            var props = OM12Connection.GetManagementPackProperties(managementObject);

            managementObject[props["LastModifiedOn"]].Value    = DateTime.UtcNow;
            managementObject[props["LatestStatus"]].Value      = latestStatus;
            managementObject[props["LatestConnectInfo"]].Value = latestConnectInfo;

            managementObject.Overwrite();
        }
        /// <summary>
        /// Updates the esight alarm.
        /// </summary>
        /// <param name="hostIp">The host ip.</param>
        /// <param name="alarmStatus">The alarm status.</param>
        /// <param name="error">The error.</param>
        public void UpdateESightNeDevice(string hostIp, int alarmStatus, string error)
        {
            IObjectReader <EnterpriseManagementObject> items =
                OM12Connection.Query <EnterpriseManagementObject>(ESightAppliance.EntityClassName, $"Host='{hostIp}'");
            EnterpriseManagementObject managementObject = items.FirstOrDefault();

            if (managementObject == null)
            {
                throw new Exception($"Can not find the eSight:{hostIp}");
            }

            var props = OM12Connection.GetManagementPackProperties(managementObject);

            managementObject[props["LastModifiedOn"]].Value             = DateTime.UtcNow;
            managementObject[props["SubscripeNeDeviceError"]].Value     = error;
            managementObject[props["SubscriptionNeDeviceStatus"]].Value = alarmStatus;

            managementObject.Overwrite();
        }