void GetDonneesObjetSnmpValues(object obj, ref object[] datas) { CSpvMibobj mibobj = obj as CSpvMibobj; if (mibobj == null) { return; } ArrayList lst = new ArrayList(); string stValue = ""; if (m_spvEquip.AdresseIP.Length > 0 && m_spvEquip.CommunauteSnmp.Length > 0) { CRequeteSnmpOID requeteSnmp = new CRequeteSnmpOID( m_spvEquip.AdresseIP, m_spvEquip.CommunauteSnmp, mibobj.GetOID()); using (CContexteDonnee ctx = new CContexteDonnee(CSc2iWin32DataClient.ContexteCourant.IdSession, true, false)) { CResultAErreur resultSnmp = requeteSnmp.GetValueSNMP(ctx); if (resultSnmp != null && resultSnmp.Data != null) { stValue = resultSnmp.Data.ToString(); } else { if (!resultSnmp) { MessageBox.Show(resultSnmp.MessageErreur.ToString(), "Timos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } lst.Add(I.T("Not found|60074")); } } } lst.Add(mibobj.OidObjet); lst.Add(mibobj.NomObjetUtilisateur); lst.Add(stValue); datas = lst.ToArray(); }
void GetDonneesObjetSnmpTableVariables(object obj, ref object[] datas) { CVarTableItem varTableItem = obj as CVarTableItem; if (varTableItem == null) { return; } ArrayList lst = new ArrayList(); lst.Add(varTableItem.index); foreach (CSpvMibobj mibobj in varTableItem.m_lstMibObj) { string stOid = mibobj.OidObjet.TrimEnd('.'); string stIndex = varTableItem.index.TrimStart('.'); CRequeteSnmpOID requeteSnmp = new CRequeteSnmpOID( m_spvEquip.AdresseIP, m_spvEquip.CommunauteSnmp, stOid + "." + stIndex); using (CContexteDonnee ctx = new CContexteDonnee(CSc2iWin32DataClient.ContexteCourant.IdSession, true, false)) { CResultAErreur resultSnmp = requeteSnmp.GetValueSNMP(ctx); if (resultSnmp != null && resultSnmp.Data != null) { string stValue = resultSnmp.Data.ToString(); lst.Add(stValue); } else { lst.Add(I.T("Not found|60074")); } } } datas = lst.ToArray(); return; }