Example #1
0
        public object GetSnmpValueForField(int nIdChampCustom)
        {
            //Récupère l'oid
            string strOid = GetFieldOID(nIdChampCustom);

            if (strOid != null && strOid.Length > 0)
            {
                CSnmpConnexion     cnx   = AgentSnmp.GetNewSnmpConnexion();
                CInterrogateurSnmp agent = new CInterrogateurSnmp();
                agent.Connexion = cnx;
                return(agent.Get(strOid));
            }
            return(null);

            /*CResultAErreur result = ReadChampSnmp(nIdChampCustom);
             * if (!result)
             *  return null;
             * CRelationEntiteSnmp_ChampCustom relChamp = CUtilElementAChamps.GetRelationToChamp(this, nIdChampCustom) as CRelationEntiteSnmp_ChampCustom;
             * if (relChamp != null)
             * {
             *  return relChamp.LastSnmpValue;
             * }
             * else
             * {
             * }
             * return result.Data ;*/
        }
Example #2
0
        //-------------------------------------------------------------------------------
        public CResultAErreur ReadChampSnmp(int nIdChampCustom)
        {
            CResultAErreur result = CResultAErreur.True;

            //Va chercher la valeur
            CSnmpConnexion     cnx   = AgentSnmp.GetNewSnmpConnexion();
            CInterrogateurSnmp agent = new CInterrogateurSnmp();

            agent.Connexion = cnx;
            return(ReadChampSnmp(nIdChampCustom, agent));
        }
Example #3
0
        //------------------------------------------
        public CResultAErreur LireValeursSnmp()
        {
            CResultAErreur result = CResultAErreur.True;

            if (TypeEntiteSnmp == null)
            {
                return(result);
            }
            IEnumerable <CChampEntiteFromQueryToChampCustom> champs = from champ in TypeEntiteSnmp.ChampsFromQuery
                                                                      where
                                                                      champ.IdChampCustom != null && !champ.Champ.NoUpdateFromSnmp
                                                                      select champ;
            CInterrogateurSnmp dynamicAgent = new CInterrogateurSnmp();

            dynamicAgent.Connexion = AgentSnmp.GetNewSnmpConnexion();
            CEntiteSnmpPourSupervision ettPourSup = null;

            foreach (CChampEntiteFromQueryToChampCustom champ in champs)
            {
                result += ReadChampSnmp(champ.IdChampCustom.Value, dynamicAgent, ref ettPourSup);
            }
            return(result);
        }