def getArguments(self):
     '''
     Extracts the specific arguments of this CLI
     '''
     ApiCli.getArguments(self)
     if self.args.pluginName != None:
         self.pluginName = self.args.pluginName
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.metricName is not None:
            self.metricName = self.args.metricName

        if self.args.source is not None:
            self.source = self.args.source
        else:
            self.source = ""

        if self.args.aggregate is not None:
            self.aggregate = self.args.aggregate
        else:
            self.aggregate = "avg"

        start_time = int(self.parse_time_date(self.args.start).strftime("%s"))

        # If the end time is not specified then
        # default to the current time
        if self.args.end is None:
            stop_time = int(self.now.strftime("%s"))
        else:
            stop_time = int(self.parse_time_date(self.args.end).strftime("%s"))

        # Convert to epoch time in milli-seconds
        start_time *= 1000
        stop_time *= 1000

        self.path = "v1/measurements/{0}".format(self.metricName)
        self.url_parameters = {"source": self.source, "start": str(start_time), "end": str(stop_time),
                               "agg": self.aggregate}
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.plugin_name is not None:
            self.plugin_name = self.args.plugin_name

        self.path = "v1/plugins/{0}".format(self.plugin_name)
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.alarmId is not None:
            self.alarmId = self.args.alarmId

        self.path = "v1/alarm/{0}".format(self.alarmId)
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.hostGroupId is not None:
            self.hostGroupId = self.args.hostGroupId

        self.path = "v1/hostgroup/{0}".format(str(self.hostGroupId))
    def getArguments(self):
        '''
        Extracts the specific arguments of this CLI
        '''
        ApiCli.getArguments(self)
        if self.args.metricName != None:
            self.metricName = self.args.metricName

        self.path = "v1/metrics/{0}".format(self.metricName)
 def getArguments(self):
     '''
     Extracts the specific arguments of this CLI
     '''
     ApiCli.getArguments(self)
     if self.args.metricName != None:
         self.metricName = self.args.metricName            
    
     self.data = {'metric': self.metricName}
     self.headers = {'Content-Type': 'application/json'}
    def getArguments(self):
        ApiCli.getArguments(self)

        if self.args.file_path is None:
            self.file_path = 'plugin.json'
        else:
            self.file_path = self.args.file_path

        self.path = "v1/metrics"

        self.load()
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.hostGroupId is not None:
            self.hostGroupId = self.args.hostGroupId
        if self.args.force is not None:
            self.force = self.args.force

        if self.force:
            self.url_parameters = {"forceRemove": True}

        self.path = "v1/hostgroup/{0}".format(str(self.hostGroupId))
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)

        if self.args.alarmName is not None:
            self.alarmName = self.args.alarmName

        if self.args.alarmId is not None:
            self.alarmId = self.args.alarmId

        if self.alarmId is not None:
            self.path = "v1/alarm/{0}".format(self.alarmId)

        if self.alarmName is not None:
            self.path = "v1/alarms/search"
            self.url_parameters={"name": self.alarmName}
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)

        # Get the list of sources separated by commas
        if self.args.sources is not None:
            self.sources = self.args.sources

        payload = {"names": []}
        if self.sources is not None:
            source_list = str.split(self.sources, ',')
            for s in source_list:
                payload['names'].append(s)

        self.data = json.dumps(payload, sort_keys=True)
        self.headers = {'Content-Type': 'application/json', "Accept": "application/json"}
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.fingerprint_fields is not None:
            self.fingerprint_fields = self.args.fingerprint_fields

        if self.args.title is not None:
            self.title = self.args.title

        if self.args.source is not None:
            self.source = self.args.source

        if self.args.severity is not None:
            self.severity = self.args.severity

        if self.args.message is not None:
            self.message = self.args.message

        event = {
            "title": "foobar",
            "fingerprintFields": ['@title'],
            "source": {"ref": "foo", "type": "bar", "name": "foobar"}
        }

        if self.title is not None:
            event['title'] = self.title

        if self.severity is not None:
            event['severity'] = self.severity

        if self.message is not None:
            event['message'] = self.message

        if self.source is not None:
            event['source'] = self.source

        if self.fingerprint_fields is not None:
            event['fingerprintFields'] = self.fingerprint_fields

        self.data = json.dumps(event, sort_keys=True)
        self.headers = {'Content-Type': 'application/json', "Accept": "application/json"}
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)
        if self.args.metricName is not None:
            self.metricName = self.args.metricName

        if self.args.measurement is not None:
            self.measurement = self.args.measurement

        if self.args.source is not None:
            self.source = self.args.source
        else:
            self.source = socket.gethostname()

        if self.args.timestamp is not None:
            self.timestamp = self.args.timestamp
        else:
            self.timestamp = int(time.time())

        m = {"metric": self.metricName, "measure": self.measurement, "source": self.source, "timestamp": self.timestamp}
        self.data = json.dumps(m, sort_keys=True)
        self.headers = {"Content-Type": "application/json", "Accept": "application/json"}
    def getArguments(self):
        """
        Extracts the specific arguments of this CLI
        """
        ApiCli.getArguments(self)

        if self.args.alarm_name is not None:
            self.alarm_name = self.args.alarm_name

        if self.args.metric_name is not None:
            self.metric_name = self.args.metric_name

        if self.args.aggregate is not None:
            self.aggregate = self.args.aggregate

        if self.args.operation is not None:
            self.operation = self.args.operation

        if self.args.threshold is not None:
            self.threshold = self.args.threshold

        if self.args.interval is not None:
            self.interval = self.args.interval

        if self.args.host_group_id is not None:
            self.host_group_id = self.args.host_group_id

        if self.args.actions is not None:
            self.actions = self.args.actions

        if self.args.note is not None:
            self.note = self.args.note

        if self.args.per_host_notify is not None:
            self.per_host_notify = self.args.per_host_notify

        if self.args.is_disabled is not None:
            self.is_disabled = self.args.is_disabled

        payload = {}

        # Create trigger predicate dictionary
        predicate = {}

        if self.aggregate is not None:
            predicate['agg'] = self.aggregate

        if self.operation is not None:
            predicate['op'] = self.operation

        if self.threshold is not None:
            predicate['val'] = self.threshold

        if 'agg' in predicate or 'op' in predicate or 'val' in predicate:
            payload['triggerPredicate'] = predicate

        # Create payload dictionary
        if self.alarm_name:
            payload['name'] = self.alarm_name

        if self.host_group_id is not None:
            payload['hostgroupId'] = self.host_group_id

        if self.interval is not None:
            payload['interval'] = self.intervals[self.interval]

        if self.metric_name is not None:
            payload['metricName'] = self.metric_name

        if self.note is not None:
            payload['note'] = self.note

        if self.actions is not None:
            payload['actions'] = self.actions

        if self.per_host_notify is not None:
            payload['perHostNotify'] = True if self.per_host_notify == 'yes' else False

        if self.is_disabled is not None:
            payload['isDisabled'] = True if self.is_disabled == 'yes' else False

        self.data = json.dumps(payload, sort_keys=True)
        self.headers = {'Content-Type': 'application/json'}