private void UpdateStatusInEnterprise() { try { int SystemEventsToGet = Convert.ToInt16(ConfigManager.Read("NoofSystemLogsToGet")); string SiteCode = DBBuilder.DBCalls.GetSiteName(); Proxy objService = new Proxy(SiteCode); BMCMonitoring objMonitoring = new BMCMonitoring(); string strServiceNames = DBBuilder.DBCalls.GetServiceNames(); string strSiteStatus = string.Empty; if (!string.IsNullOrEmpty(strServiceNames)) { strSiteStatus = objMonitoring.GetSiteStatus(strServiceNames, SystemEventsToGet); } if (!string.IsNullOrEmpty(strSiteStatus)) { //UpdateSiteServiceDetails(SiteCode, strSiteStatus); //LogManager.WriteLog("Site status updated in exchange.", LogManager.enumLogLevel.Info); objService.UpdateSiteStatsInEnterprise(SiteCode, strSiteStatus); LogManager.WriteLog("Site status updated in enterrprise.", LogManager.enumLogLevel.Info); } } catch (Exception ex) { ExceptionManager.Publish(ex); } }
private void RestartServices() { string strServiceName = string.Empty; try { BMCMonitoring objMonitoring = new BMCMonitoring(); string strServiceNames = DBBuilder.DBCalls.GetServiceNames(); LogManager.WriteLog("RestartServices: Service to restart " + strServiceNames, LogManager.enumLogLevel.Info); string strSiteStatus = string.Empty; int SystemEventsToGet = Convert.ToInt16(ConfigManager.Read("NoofSystemLogsToGet")); if (!string.IsNullOrEmpty(strServiceNames)) { strSiteStatus = objMonitoring.GetSiteStatus(strServiceNames, SystemEventsToGet); DataTable dtServiceStatus = GetServiceStatus(strSiteStatus); foreach (DataRow dr in dtServiceStatus.Rows) { if (dr["ServiceStatus"].ToString().ToUpper() != "RUNNING") { strServiceName = dr["ServiceName"].ToString(); if (strServiceName.ToUpper() != "BMCGUARDIANSERVICE") { try { if (objMonitoring.RestartService(strServiceName)) { LogManager.WriteLog(strServiceName + " Restarted", LogManager.enumLogLevel.Info); } else { LogManager.WriteLog("Error while restarting " + strServiceName, LogManager.enumLogLevel.Info); } } catch (Exception ex1) { LogManager.WriteLog("Error while restarting " + strServiceName, LogManager.enumLogLevel.Error); ExceptionManager.Publish(ex1); } } } } } } catch (Exception ex) { ExceptionManager.Publish(ex); } }