Exemple #1
0
    def process(self):
        logger.info("Started SDEE Collector")
        if self.__hostname:
            self.host = self.__hostname
        else:
            self.host = self._plugin.get("config", "source_ip")
        if self.__username:
            self.username = self.__username
        else:
            self.username = self._plugin.get("config", "user")
        if self.__password:
            self.password = self.__password
        else:
            self.password = self._plugin.get("config", "password")
        self.sleepField = self._plugin.get("config", "sleep")
        self.plugin_id = self._plugin.get("DEFAULT", "plugin_id")

        sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
        try:
            sdee.open()
            logger.info("SDEE subscriberId %s" % sdee._subscriptionid)
            f = open(self.sIdFile, 'w')
            f.write("%s\n" % sdee._subscriptionid)
            f.close()

        except:
            logger.error("Error opening SDEE connection with device %s" % self.host)
            logger.info("SDEE: Trying to close last session")
            try:
                f = open(self.sIdFile, 'r')
            except IOError:
                logger.error("SDEE: Cannot read subscriber ID")
                return
            subs = f.readline()

            try:
                sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
                sdee._subscriptionid = subs
                sdee.close()

            except:
                logger.error("SDEE: losing last session Failed")
                return

            try:
                sdee = SDEE(user=self.username,password=self.password,host=self.host,method='https', force='yes')
                sdee.open()
                logger.info("SDEE subscriberId %s" % sdee._subscriptionid)
                f = open(self.sIdFile, 'w')
                f.write("%s\n" % sdee._subscriptionid)
                f.close()

            except:
                logger.error("SDEE Failed")
                return

        while 1:
            sdee.get()
            logger.info("Requesting SDEE Data...")
            data = sdee.data()
            logger.debug(data)
            self.parse(data)
            time.sleep(int(self.sleepField))
from pySDEE import SDEE
import sys

subs = sys.argv[1]
sdee = SDEE(user='', password='', host='', method='https', force='yes')
sdee._subscriptionid = subs
sdee.close()
Exemple #3
0
    def process(self):
        logger.info("Started SDEE Collector")
        if self.__hostname:
            self.host = self.__hostname
        else:
            self.host = self._plugin.get("config", "source_ip")
        if self.__username:
            self.username = self.__username
        else:
            self.username = self._plugin.get("config", "user")
        if self.__password:
            self.password = self.__password
        else:
            self.password = self._plugin.get("config", "password")
        self.sleepField = self._plugin.get("config", "sleep")
        self.plugin_id = self._plugin.get("DEFAULT", "plugin_id")

        sdee = SDEE(user=self.username,
                    password=self.password,
                    host=self.host,
                    method='https',
                    force='yes')
        try:
            sdee.open()
            logger.info("SDEE subscriberId %s" % sdee._subscriptionid)
            f = open(self.sIdFile, 'w')
            f.write("%s\n" % sdee._subscriptionid)
            f.close()

        except:
            logger.error("Error opening SDEE connection with device %s" %
                         self.host)
            logger.info("SDEE: Trying to close last session")
            try:
                f = open(self.sIdFile, 'r')
            except IOError:
                logger.error("SDEE: Cannot read subscriber ID")
                return
            subs = f.readline()

            try:
                sdee = SDEE(user=self.username,
                            password=self.password,
                            host=self.host,
                            method='https',
                            force='yes')
                sdee._subscriptionid = subs
                sdee.close()

            except:
                logger.error("SDEE: losing last session Failed")
                return

            try:
                sdee = SDEE(user=self.username,
                            password=self.password,
                            host=self.host,
                            method='https',
                            force='yes')
                sdee.open()
                logger.info("SDEE subscriberId %s" % sdee._subscriptionid)
                f = open(self.sIdFile, 'w')
                f.write("%s\n" % sdee._subscriptionid)
                f.close()

            except:
                logger.error("SDEE Failed")
                return

        while 1:
            sdee.get()
            logger.info("Requesting SDEE Data...")
            data = sdee.data()
            logger.debug(data)
            self.parse(data)
            time.sleep(int(self.sleepField))
Exemple #4
0
from pySDEE import SDEE
import sys

subs = sys.argv[1]
sdee = SDEE(user="", password="", host="", method="https", force="yes")
sdee._subscriptionid = subs
sdee.close()