Пример #1
0
def main():

  setSnmp(ipHostSnmp,oidLogicalSpare1,1)
  nameLogic,  valLogic  = getSnmp(ipHostSnmp,oidLogicalSpare1)

  while(int(valLogic)):
    nameLogic,  valLogic  = getSnmp(ipHostSnmp,oidLogicalSpare1)
    
    try:
      nameSalon,   valSalon   = getSnmp(ipHostSnmpAudio,oidAmpliSalonState)
      nameCuisine, valCuisine = getSnmp(ipHostSnmpAudio,oidAmpliCuisineState)
      nameSdb,     valSdb     = getSnmp(ipHostSnmpAudio,oidAmpliSdbState)
      nameChambre, valChambre = getSnmp(ipHostSnmpAudio,oidAmpliChambreState)
      nameVMC,     valVMC     = getSnmp(ipHostSnmp,oidVmcPowerState)
      nameVentilo, valVentilo = getSnmp(ipHostSnmp,oidVentiloPowerState)
      nameThermo,  valThermo  = getSnmp(ipHostSnmp,oidThermoState)
    except:
      print 'getSnmp Fail'

    bus1.writePin(pinCuisine, int(valCuisine))
    time.sleep(0.5)
    bus1.writePin(pinChambre, int(valChambre))
    time.sleep(0.5)
    bus1.writePin(pinSdb, int(valChambre))
    ##bus1.writePin(pinSdb, int(valSdb))
    bus1.writePin(pinVMC, int(valVMC))
    time.sleep(0.5)
    bus1.writePin(pinVentilo, int(valVentilo))
    time.sleep(0.5)
    bus1.writePin(pinThermo, int(valThermo))
Пример #2
0
#!/usr/bin/python 
import time,sys
from setsnmp import setSnmp

ipHostSnmp           = "192.168.0.110"
oidLogicalSpare1     = "1.3.6.1.4.1.43689.1.6.4.0"

if __name__ == "__main__":
  setSnmp(ipHostSnmp,oidLogicalSpare1,0)

Пример #3
0
#!/usr/bin/python 
import time,sys
from setsnmp import setSnmp

ipHostSnmp           = "192.168.0.110"
oidVmcPowerState     = "1.3.6.1.4.1.43689.1.6.1.0"
oidVentiloPowerState = "1.3.6.1.4.1.43689.1.6.2.0"

if __name__ == "__main__":
  setSnmp(ipHostSnmp,oidVmcPowerState,0)
  setSnmp(ipHostSnmp,oidVentiloPowerState,1)

Пример #4
0
def getSnmp(host,oid):
  cmdGen = cmdgen.CommandGenerator()

  errorIndication, errorStatus, errorIndex, varBinds = cmdGen.getCmd(
      cmdgen.CommunityData('public', mpModel=0),
      cmdgen.UdpTransportTarget((host, 161)),
      oid
      )
  # Check for errors and print out results
  if errorIndication:
      print(errorIndication)
  else:
      if errorStatus:
          print('%s at %s' % (
              errorStatus.prettyPrint(),
              errorIndex and varBinds[int(errorIndex)-1] or '?'
              )
          )
      else:
          for name, val in varBinds:
              return name.prettyPrint(), val.prettyPrint()

if __name__ == "__main__":

  oidCaveTemp, tempCave = getSnmp(ipHostCave,oidArduinoCaveTemp)
  resultSetT = setSnmp(ipHostSnmp,oidDht22CaveTemp,int(tempCave))

  oidCaveHum, humCave = getSnmp(ipHostCave,oidArduinoCaveHum)
  resultSetH = setSnmp(ipHostSnmp,oidDht22CaveHum,int(humCave))

Пример #5
0
#!/usr/bin/python 
import time,sys
from setsnmp import setSnmp
from getsnmp import getSnmp

ipHostSnmp           = "192.168.0.110"
oidForceVmc          = "1.3.6.1.4.1.43689.1.6.5.0"

if __name__ == "__main__":
  nameForceVMC,  valForceVMC  = getSnmp(ipHostSnmp,oidForceVmc)
  if int(valForceVMC):
    setSnmp(ipHostSnmp,oidForceVmc,0)
    print 'VMC is On and will be set to automatic mode'
  else:
    setSnmp(ipHostSnmp,oidForceVmc,1)
    print 'VMC is in automatic mode and will be forced to On'

Пример #6
0
  fichierWrite = open(fileToBeWriten,'a')
  fichierWrite.write(text)
  fichierWrite.write('\n')
  fichierWrite.close()

def readlog():
  fileLog = "/home/dimi/prog/ftpScript/ftpLog.txt"
  fichierRead = open(fuelFileData,'r')
  logLine = fichierRead.read()
  fileReadWrite.close()
  return logLine

if __name__ == "__main__":
  ftpState = os.popen('/usr/sbin/pure-ftpwho -s')

  resultSetUser = setSnmp(ipHostSnmp,oidUser1,0)
  resultSetUser = setSnmp(ipHostSnmp,oidUser2,0)
  resultSetUser = setSnmp(ipHostSnmp,oidUser3,0)
  resultSetUser = setSnmp(ipHostSnmp,oidUser4,0)
  resultSetUser = setSnmp(ipHostSnmp,oidUser5,0)

  while 1:
    loggedFtp = ftpState.readline()
    if not loggedFtp: 
      break
    else:
      loggedFtp = loggedFtp.split('|')
      userFtp     = loggedFtp[1]
      timeDwnld   = loggedFtp[2]
      actionFtp   = loggedFtp[3]
      fileFtp     = loggedFtp[4]
Пример #7
0
def logic_VMC():
  tempExtEte = 180

  nameTempExt,  valTempExt  = getSnmp(ipHostSnmp,oidDht22ExtTemp)
  nameHumExt,   valHumExt   = getSnmp(ipHostSnmp,oidDht22ExtHum)
  nameHumSalon, valHumSalon = getSnmp(ipHostSnmp,oidDht22SalonHum)
  nameHumSdb,   valHumSdb   = getSnmp(ipHostSnmp,oidDht22SdbHum)
  nameForceVMC, valForceVMC = getSnmp(ipHostSnmp,oidForceVMC)

  valTempExt = int(valTempExt)
  valHumExt = int(valHumExt)
  valHumSalon = int(valHumSalon)
  valHumSdb = int(valHumSdb)

  coefTuning = 2.0      # coef high reduce VMC runing
  deltaHumMax = max(150.,(valHumExt - valHumSalon)/coefTuning)
  valHumMax = max(valHumSalon + deltaHumMax,800.)

  #if (valTempExt > tempExtEte + 5.):
  if ((valTempExt > tempExtEte + 5.) or int(valForceVMC)):
    setSnmp(ipHostSnmp,oidVmcPowerState,1)
    setSnmp(ipHostSnmp,oidVentiloPowerState,0)
  else:
    if (valHumSdb > valHumMax):
      setSnmp(ipHostSnmp,oidVmcPowerState,1)
      setSnmp(ipHostSnmp,oidVentiloPowerState,0)
    if ((valHumSdb < valHumMax - 100.) and (valTempExt < tempExtEte - 5.)):
      setSnmp(ipHostSnmp,oidVmcPowerState,0)
      setSnmp(ipHostSnmp,oidVentiloPowerState,1)