Exemple #1
0
        //-----------------------------------------------------------------------
        public IDonneeSynchronisationMediation GetDonneesPourSynchro(int nIdProxy, int nIdLastSyncSessionConnue)
        {
            if (m_synchroniseurServiceMediation != null)
            {
                try
                {
                    return(m_synchroniseurServiceMediation.GetUpdatesForProxy(nIdProxy, nIdLastSyncSessionConnue));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }

            //Demande au proxy précédent d'aller chercher les données
            foreach (CSnmpProxy proxy in CSnmpProxyConfiguration.GetInstance().GetProxiesPrecedents())
            {
                try
                {
                    ISnmpConnexion connexion = proxy.GetConnexion();
                    return(connexion.GetDonneesPourSynchro(nIdProxy, nIdLastSyncSessionConnue));
                }
                catch { }
            }
            return(null);
        }
Exemple #2
0
        //-----------------------------------------------------------------------
        public CResultAErreur SendDonneesPooled(List <CDonneeCumuleeTransportable> lstDonnees)
        {
            if (m_synchroniseurServiceMediation != null)
            {
                try
                {
                    return(m_synchroniseurServiceMediation.SendDonneesPooled(lstDonnees));
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
            }

            //Demande au proxy précédent d'aller chercher les données
            foreach (CSnmpProxy proxy in CSnmpProxyConfiguration.GetInstance().GetProxiesPrecedents())
            {
                try
                {
                    ISnmpConnexion connexion = proxy.GetConnexion();
                    return(connexion.SendDonneesPooled(lstDonnees));
                }
                catch { }
            }
            return(null);
        }
Exemple #3
0
 //--------------------------------------------------------------------
 public void RedescendAlarmes(CMemoryDb dbContenantLesAlarmesARedescendre)
 {
     CServiceMediation.GetDefaultInstance().RedescendAlarmes(dbContenantLesAlarmesARedescendre);
     foreach (CSnmpProxy proxy in CSnmpProxyConfiguration.GetInstance().ListeProxySuivants)
     {
         try
         {
             ISnmpConnexion           connexion = proxy.GetConnexion();
             RedescendAlarmesDelegate del       = new RedescendAlarmesDelegate(RedescendAlarmeAsync);
             del.BeginInvoke(connexion, dbContenantLesAlarmesARedescendre, null, null);
         }
         catch
         {
         }
     }
 }
Exemple #4
0
 protected override void OnStart(string[] args)
 {
     try
     {
         C2iEventLog.Init("Timos", NiveauBavardage.VraiPiplette);
         RemotingConfiguration.Configure(AppDomain.CurrentDomain.BaseDirectory + "\\serviceMediation.remoting.config", false);
         RemotingConfiguration.CustomErrorsMode = CustomErrorsModes.On;
         CAutoexecuteurClasses.RunAllAutoexecs();
         CSnmpProxyConfiguration.GetInstance().MiseAJour(true);
         CServiceMediation.GetDefaultInstance().Configuration.MettreAJour(true, true);
     }
     catch (Exception e)
     {
         C2iEventLog.WriteErreur(e.Message);
         throw e;
     }
 }
Exemple #5
0
        //---------------------------------------------------
        public CSnmpProxyConfiguration GetConfigurationDeSnmpProxy(int nIdProxy)
        {
            if (m_fournisseurDeConfiguration != null)
            {
                return(m_fournisseurDeConfiguration.GetConfigurationDeProxy(nIdProxy));
            }
            foreach (CSnmpProxy proxy in CSnmpProxyConfiguration.GetInstance().GetProxiesPrecedents())
            {
                try
                {
                    ISnmpConnexion connexion = proxy.GetConnexion();
                    return(connexion.GetConfigurationDeSnmpProxy(nIdProxy));
                }
                catch { }
            }

            return(null);
        }
Exemple #6
0
        //--------------------------------------------------------------------
        public CResultAErreurType <CMappageIdsAlarmes> RemonteAlarmes(CMemoryDb dbContenantLesAlarmesARemonter)
        {
            CResultAErreurType <CMappageIdsAlarmes> result = new CResultAErreurType <CMappageIdsAlarmes>();

            if (m_traiteurAlarme != null)
            {
                return(m_traiteurAlarme.Traite(dbContenantLesAlarmesARemonter));
            }
            else
            {
                foreach (CSnmpProxy proxy in CSnmpProxyConfiguration.GetInstance().GetProxiesPrecedents())
                {
                    ISnmpConnexion connexion = proxy.GetConnexion();
                    return(connexion.RemonteAlarmes(dbContenantLesAlarmesARemonter));
                }
            }
            result.EmpileErreur(I.T("Can not manage alarms"));

            return(result);
        }
Exemple #7
0
 //---------------------------------------------------
 public void NotifyProxyNecessiteMAJ(
     int nIdProxy,
     bool bConfigProxy,
     bool bServiceMediation,
     bool bFullSync)
 {
     if (IsMySelf())
     {
         StringBuilder bl = new StringBuilder();
         bl.Append("Proxy setup update requiered ");
         bl.Append("proxy setup=");
         bl.Append(bConfigProxy);
         bl.Append(", mediation setup=");
         bl.Append(bServiceMediation);
         bl.Append(", Full update=");
         bl.Append(bFullSync);
         CServiceMediation.GetDefaultInstance().Trace.Write(bl.ToString(), ALTRACE.DEBUG, ALTRACE.POLLING, ALTRACE.TRACE);
         CSnmpProxyConfiguration.GetInstance().IdProxyConfiguré = nIdProxy;
         if (bConfigProxy)
         {
             CSnmpProxyConfiguration.GetInstance().MiseAJour(false);
         }
         if (bServiceMediation)
         {
             CServiceMediation.GetDefaultInstance().Configuration.MettreAJour(bFullSync, true);
         }
     }
     else
     {
         ISnmpConnexion cnxDisttante = GetConnexionDistante();
         if (cnxDisttante != null)
         {
             cnxDisttante.NotifyProxyNecessiteMAJ(nIdProxy, bConfigProxy, bServiceMediation, bFullSync);
         }
     }
 }
Exemple #8
0
 //--------------------------------------------------------------------
 public void UpdateAgentIpFromMediation(string strAgentId, string strNewIp, bool bUpdateTimosDb)
 {
     if (m_traiteurAlarme != null)
     {
         m_traiteurAlarme.UpdateAgentIpFromMediation(strAgentId, strNewIp, bUpdateTimosDb);
     }
     else
     {
         CServiceMediation service = CServiceMediation.GetDefaultInstance();
         if (service != null && service.Configuration != null && service.Configuration.DataBase != null)
         {
             CAgentSnmpPourSupervision agent = service.Configuration.DataBase.GetEntite <CAgentSnmpPourSupervision>(strAgentId);
             if (agent != null)
             {
                 agent.Ip = strNewIp;
             }
         }
         foreach (CSnmpProxy proxy in CSnmpProxyConfiguration.GetInstance().GetProxiesPrecedents())
         {
             ISnmpConnexion cnx = proxy.GetConnexion();
             cnx.UpdateAgentIpFromMediation(strAgentId, strNewIp, bUpdateTimosDb);
         }
     }
 }
Exemple #9
0
        private void m_btnConfiguration_Click(object sender, EventArgs e)
        {
            CSnmpProxyConfiguration config = CSnmpProxyConfiguration.GetInstance();

            if (config != null)
            {
                StringBuilder sBuilder = new StringBuilder();
                sBuilder.AppendLine("My SNMP Configuration is :");

                foreach (CSnmpProxy proxy in config.ListeProxy)
                {
                    sBuilder.Append("\t");
                    sBuilder.AppendLine(proxy.NomProxy);

                    foreach (CPlageIP plage in proxy.PlagesIP)
                    {
                        sBuilder.Append("\t\t");
                        sBuilder.AppendLine(plage.ModeleIpString + "/" + plage.Mask.ToString());
                    }
                }

                MessageBox.Show(sBuilder.ToString());
            }
        }
Exemple #10
0
 private void Form1_Load(object sender, EventArgs e)
 {
     CSnmpProxyConfiguration.GetInstance().MiseAJour(true);
     CServiceMediation.GetDefaultInstance().Configuration.MettreAJour(true, true);
 }