Пример #1
0
        smtpFromAddr = ""
        smtpToAddr = ""
        if smtpActivated is True:
            smtpServer = str(
                configRoot.find("smtp").find("server").attrib["host"])
            smtpPort = int(
                configRoot.find("smtp").find("server").attrib["port"])
            smtpFromAddr = str(
                configRoot.find("smtp").find("general").attrib["fromAddr"])
            smtpToAddr = str(
                configRoot.find("smtp").find("general").attrib["toAddr"])

        # parse all alerts
        for item in configRoot.find("alerts").iterfind("alert"):

            alert = ExecuterAlert()

            # Get executer specific values.
            temp_execute = make_path(
                str(item.find("executer").attrib["execute"]))
            alert.cmd_triggered_list.append(temp_execute)
            alert.cmd_normal_list.append(temp_execute)
            alert.cmd_profile_change_list.append(temp_execute)

            # Parse all arguments that are used for the command when
            # a sensor alert with state "triggered" is received.
            cmd_triggered_activated = str(
                item.find("executer").find(
                    "triggered").attrib["activated"]).upper() == "TRUE"
            alert.cmd_triggered_activated = cmd_triggered_activated
            if cmd_triggered_activated:
Пример #2
0
			updateInterval = int(
				configRoot.find("update").find("general").attrib["interval"])
			updateEmailNotification = (str(
				configRoot.find("update").find("general").attrib[
				"emailNotification"]).upper() == "TRUE")

			# email notification works only if smtp is activated
			if (updateEmailNotification is True
				and smtpActivated is False):
				raise ValueError("Update check can not have email "
					+ "notification activated when smtp is not activated.")

		# parse all alerts
		for item in configRoot.find("alerts").iterfind("alert"):

			alert = ExecuterAlert()

			# get executer specific values
			tempExecute = makePath(
				str(item.find("executer").attrib["execute"]))
			alert.triggerExecute.append(tempExecute)
			alert.stopExecute.append(tempExecute)

			# parse all arguments that are used for the command when
			# an alert is triggered
			for argument in item.find("executer").iterfind("triggerArgument"):
				alert.triggerExecute.append(str(argument.text))

			# parse all arguments that are used for the command when
			# an alert is stopped
			for argument in item.find("executer").iterfind("stopArgument"):
Пример #3
0
			configRoot.find("smtp").find("general").attrib[
			"activated"]).upper()	== "TRUE")
		if smtpActivated is True:
			smtpServer = str(
				configRoot.find("smtp").find("server").attrib["host"])
			smtpPort = int(
				configRoot.find("smtp").find("server").attrib["port"])
			smtpFromAddr = str(
				configRoot.find("smtp").find("general").attrib["fromAddr"])
			smtpToAddr = str(
				configRoot.find("smtp").find("general").attrib["toAddr"])

		# parse all alerts
		for item in configRoot.find("alerts").iterfind("alert"):

			alert = ExecuterAlert()

			# get executer specific values
			tempExecute = str(item.find("executer").attrib["execute"])
			alert.triggerExecute.append(tempExecute)
			alert.stopExecute.append(tempExecute)

			# parse all arguments that are used for the command when
			# an alert is triggered
			for argument in item.find("executer").iterfind("triggerArgument"):
				alert.triggerExecute.append(str(argument.text))

			# parse all arguments that are used for the command when
			# an alert is stopped
			for argument in item.find("executer").iterfind("stopArgument"):
				alert.stopExecute.append(str(argument.text))