Example #1
0
    def ComponentStatusUpdate(self, statuspage_id, component, container,
                              details, current_status):
        """Update the status of a component on the fly without creating an incident or maintenance.

           Args:
             statuspage_id:
               Status page ID
             component:
               ID of affected component
             container:
               ID of affected container
             details:
               A brief message describing this update
             current_status:
               Any numeric status code.

           Returns:
             A JSON object.
        """
        url = '%s/component/status/update' % self.base_url
        resp = self._RequestUrl(url,
                                'POST',
                                data={
                                    'statuspage_id': statuspage_id,
                                    'component': component,
                                    'container': container,
                                    'details': details,
                                    'current_status': current_status
                                })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #2
0
    def ComponentStatusUpdate(self,
                              statuspage_id,
                              components,
                              containers,
                              details,
                              current_status):
        """Update the status of a component on the fly without creating an incident or maintenance.

           Args:
             statuspage_id:
               Status page ID
             components:
               ID of each affected component
             containers:
               ID of each affected container
             details:
               A brief message describing this update
             current_status:
               Any numeric status code.

           Returns:
             A JSON object.
        """
        url = '%s/component/status/update' % self.base_url
        resp = self._RequestUrl(url, 'POST', data={
            'statuspage_id': statuspage_id,
            'components': components,
            'containers': containers,
            'details': details,
            'current_status': current_status
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #3
0
    def SubscriberUpdate(self,
                         statuspage_id,
                         subscriber_id,
                         address,
                         granular=''):
        """Update existing subscriber

           Args:
             statuspage_id:
               Status page ID
             subscriber_id:
               SubscriberAdd ID
             address:
               Subscriber address (SMS number must include country code ie. +1)
             granular:
               List of component_container combos

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/update' % self.base_url
        resp = self._RequestUrl(url, 'PATCH', {
            'statuspage_id': statuspage_id,
            'subscriber_id': subscriber_id,
            'address': address,
            'granular': granular,
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #4
0
    def SubscriberAdd(self,
                      statuspage_id,
                      method,
                      address,
                      silent='1',
                      granular=''):
        """Add a new subscriber

           Args:
             statuspage_id:
               Status page ID
             method:
               Communication method of subscriber. Valid methods are `email`, `sms` or `webhook`
             address:
               Subscriber address (SMS number must include country code ie. +1)
             silent:
               Supress the welcome message ('1' = Do not send notification)
             granular:
               List of component_container combos

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/add' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'method': method,
                'address': address,
                'silent': silent,
                'granular': granular,
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #5
0
    def SubscriberAdd(self,
                      statuspage_id,
                      method,
                      address,
                      silent=1,
                      granular=''):
        """Add a new subscriber

           Args:
             statuspage_id:
               Status page ID
             method:
               Communication method of subscriber. Valid methods are `email`, `sms` or `webhook`
             address:
               Subscriber address (SMS number must include country code ie. +1)
             silent:
               Supress the welcome message (1 = Do not send notification)
             granular:
               List of component_container combos

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/add' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'method': method,
            'address': address,
            'silent': silent,
            'granular': granular,
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #6
0
    def SubscriberUpdate(self,
                         statuspage_id,
                         subscriber_id,
                         address,
                         granular=''):
        """Update existing subscriber

           Args:
             statuspage_id:
               Status page ID
             subscriber_id:
               SubscriberAdd ID
             address:
               Subscriber address (SMS number must include country code ie. +1)
             granular:
               List of component_container combos

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/update' % self.base_url
        resp = self._RequestUrl(
            url, 'PATCH', {
                'statuspage_id': statuspage_id,
                'subscriber_id': subscriber_id,
                'address': address,
                'granular': granular,
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #7
0
    def MetricUpdate(self, statuspage_id, metric_id, day_avg, day_start,
                     day_dates, day_values, week_avg, week_start, week_dates,
                     week_values, month_avg, month_start, month_dates,
                     month_values):
        """Update custom metric data

           Args:
             statuspage_id:
               Status page ID
             metric_id:
               Metric ID
             day_avg:
               Average value for past 24 hours
             day_start:
               UNIX timestamp for start of metric timeframe
             day_dates:
               An array of timestamps for the past 24 hours (2014-03-28T05:43:00+00:00)
             day_values:
               An array of values matching the timestamps (Must be 24 values)
             week_avg:
               Average value for past 7 days
             week_start:
               UNIX timestamp for start of metric timeframe
             week_dates:
               An array of timestamps for the past 7 days (2014-03-28T05:43:00+00:00)
             week_values:
               An array of values matching the timestamps (Must be 7 values)
             month_avg:
               Average value for past 30 days
             month_start:
               UNIX timestamp for start of metric timeframe
             month_dates:
               An array of timestamps for the past 30 days (2014-03-28T05:43:00+00:00)
             month_values:
               An array of values matching the timestamps (Must be 30 values)

           Returns:
             A JSON object.
        """
        url = '%s/metric/update' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'metric_id': metric_id,
                'day_avg': day_avg,
                'day_start': day_start,
                'day_dates': day_dates,
                'day_values': day_values,
                'week_avg': week_avg,
                'week_start': week_start,
                'week_dates': week_dates,
                'week_values': week_values,
                'month_avg': month_avg,
                'month_start': month_start,
                'month_dates': month_dates,
                'month_values': month_values
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #8
0
    def MaintenanceFinish(self,
                          statuspage_id,
                          maintenance_id,
                          maintenance_details,
                          message_subject,
                          notify_email="0",
                          notify_sms="0",
                          notify_webhook="0",
                          social="0",
                          irc="0",
                          hipchat="0",
                          slack="0"):
        """Close an active maintenance. The maintenance will be moved to the history.

           Args:
             statuspage_id:
               Status page ID
             maintenance_id:
               Maintenance ID
             maintenance_details:
               Message describing this maintenance update
             message_subject:
               The message subject for email notifications
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/finish' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'maintenance_id': maintenance_id,
                'maintenance_details': maintenance_details,
                'notify_email': notify_email,
                'notify_sms': notify_sms,
                'notify_webhook': notify_webhook,
                'social': social,
                'irc': irc,
                'hipchat': hipchat,
                'slack': slack,
                'message_subject': message_subject
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #9
0
    def MaintenanceUpdate(self,
                          statuspage_id,
                          maintenance_id,
                          maintenance_details,
                          notify_email=0,
                          notify_sms=0,
                          notify_webhook=0,
                          social=0,
                          irc=0,
                          hipchat=0,
                          slack=0):
        """Update an active maintenance

           Args:
             statuspage_id:
               Status page ID
             maintenance_id:
               Maintenance ID
             maintenance_details:
               Message describing this maintenance update
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/update' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'maintenance_id': maintenance_id,
                'maintenance_details': maintenance_details,
                'notify_email': notify_email,
                'notify_sms': notify_sms,
                'notify_webhook': notify_webhook,
                'social': social,
                'irc': irc,
                'hipchat': hipchat,
                'slack': slack
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #10
0
    def MaintenanceFinish(self,
                          statuspage_id,
                          maintenance_id,
                          maintenance_details,
                          notify_email=0,
                          notify_sms=0,
                          notify_webhook=0,
                          social=0,
                          irc=0,
                          hipchat=0,
                          slack=0):
        """Close an active maintenance. The maintenance will be moved to the history.

           Args:
             statuspage_id:
               Status page ID
             maintenance_id:
               Maintenance ID
             maintenance_details:
               Message describing this maintenance update
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/finish' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'maintenance_id': maintenance_id,
            'maintenance_details': maintenance_details,
            'notify_email': notify_email,
            'notify_sms': notify_sms,
            'notify_webhook': notify_webhook,
            'social': social,
            'irc': irc,
            'hipchat': hipchat,
            'slack': slack
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #11
0
    def SubscriberList(self, statuspage_id):
        """List all subscribers

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/list/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #12
0
    def StatusSummary(self, statuspage_id):
        """Show the summary status for all components and containers

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/status/summary/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #13
0
    def MaintenanceList(self, statuspage_id):
        """List all active, resolved and upcoming maintenances

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/list/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #14
0
    def ComponentList(self, statuspage_id):
        """List all components.

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/component/list/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #15
0
    def IncidentListByID(self, statuspage_id):
        """List all active and resolved incidents by ID.

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/incidents/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #16
0
    def ComponentList(self, statuspage_id):
        """List all components.

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/component/list/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #17
0
    def StatusSummary(self, statuspage_id):
        """Show the summary status for all components and containers

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/status/summary/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #18
0
    def SubscriberList(self, statuspage_id):
        """List all subscribers

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/list/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #19
0
    def MaintenanceListByID(self, statuspage_id):
        """List all active, resolved and upcoming maintenances by ID

           Args:
             statuspage_id:
               Status page ID

           Returns:
             A JSON object.
        """
        url = '%s/maintenances/%s' % (self.base_url, statuspage_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #20
0
    def IncidentSingle(self, statuspage_id, incident_id):
        """Get single incident.

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Incident ID

           Returns:
             A JSON object.
        """
        url = '%s/incident/%s/%s' % (self.base_url, statuspage_id, incident_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #21
0
    def IncidentMessage(self, statuspage_id, message_id):
        """Display incident message.

           Args:
             statuspage_id:
               Status page ID
             message_id:
               Message ID

           Returns:
             A JSON object.
        """
        url = '%s/incident/message/%s/%s' % (self.base_url, statuspage_id,
                                             message_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #22
0
    def MaintenanceSingle(self, statuspage_id, maintenance_id):
        """Display maintenance message

           Args:
             statuspage_id:
               Status page ID
             maintenance_id:
               Maintenance ID

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/%s/%s' % (self.base_url, statuspage_id,
                                        maintenance_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #23
0
    def SubscriberRemove(self, statuspage_id, subscriber_id):
        """Delete subscriber

           Args:
             statuspage_id:
               Status page ID
             subscriber_id:
               Subscriber ID

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/remove/%s/%s' % (self.base_url, statuspage_id,
                                              subscriber_id)
        resp = self._RequestUrl(url, 'DELETE')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #24
0
    def MaintenanceMessage(self,
                           statuspage_id,
                           message_id):
        """Display maintenance message

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Message ID

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/message/%s/%s' % (
            self.base_url, statuspage_id, message_id)
        resp = self._RequestUrl(url, 'GET')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #25
0
    def MaintenanceDelete(self, statuspage_id, maintenance_id):
        """Delete an existing maintenance. The maintenance will be deleted forever and cannot be recovered.

           Args:
             statuspage_id:
               Status page ID
             maintenance_id:
               Maintenance ID

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/delete' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'maintenance_id': maintenance_id
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #26
0
    def SubscriberRemove(self,
                         statuspage_id,
                         subscriber_id):
        """Delete subscriber

           Args:
             statuspage_id:
               Status page ID
             subscriber_id:
               Subscriber ID

           Returns:
             A JSON object.
        """
        url = '%s/subscriber/remove/%s/%s' % (
            self.base_url, statuspage_id, subscriber_id)
        resp = self._RequestUrl(url, 'DELETE')
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #27
0
    def IncidentDelete(self, statuspage_id, incident_id):
        """Delete an existing incident. The incident will be deleted forever and cannot be recovered.

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Incident ID

           Returns:
             A JSON object.
        """
        url = '%s/incident/delete' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'incident_id': incident_id
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #28
0
    def IncidentDelete(self,
                       statuspage_id,
                       incident_id):
        """Delete an existing incident. The incident will be deleted forever and cannot be recovered.

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Incident ID

           Returns:
             A JSON object.
        """
        url = '%s/incident/delete' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'incident_id': incident_id
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #29
0
    def MaintenanceDelete(self,
                          statuspage_id,
                          maintenance_id):
        """Delete an existing maintenance. The maintenance will be deleted forever and cannot be recovered.

           Args:
             statuspage_id:
               Status page ID
             maintenance_id:
               Maintenance ID

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/delete' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'maintenance_id': maintenance_id
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #30
0
    def MaintenanceSchedule(self,
                            statuspage_id,
                            components,
                            containers,
                            maintenance_name,
                            maintenance_details,
                            date_planned_start,
                            time_planned_start,
                            date_planned_end,
                            time_planned_end,
                            automation=0,
                            all_infrastructure_affected=0,
                            maintenance_notify_now=0,
                            maintenance_notify_1_hr=0,
                            maintenance_notify_24_hr=0,
                            maintenance_notify_72_hr=0):
        """Schedule a new maintenance

           Args:
             statuspage_id:
               Status page ID
             components:
               ID of each affected component
             containers:
               ID of each affected container
             maintenance_name:
               A descriptive title for this maintenance
             maintenance_details:
               Message describing this maintenance
             date_planned_start:
               Date maintenance is expected to start
             time_planned_start:
               Time maintenance is expected to start
             date_planned_end:
               Date maintenance is expected to end
             time_planned_end:
               Time maintenance is expected to end
             automation:
               Automatically start and end the maintenance (default = 0)
             all_infrastructure_affected:
               Affect all components and containers (default = 0)
             maintenance_notify_now:
               Notify subscribers now (1 = Send notification)
             maintenance_notify_1_hr:
               Notify subscribers 1 hour before scheduled maintenance start time (1 = Send notification)
             maintenance_notify_24_hr:
               Notify subscribers 24 hours before scheduled maintenance start time (1 = Send notification)
             maintenance_notify_72_hr:
               Notify subscribers 72 hours before scheduled maintenance start time (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/schedule' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'components': components,
            'containers': containers,
            'maintenance_name': maintenance_name,
            'maintenance_details': maintenance_details,
            'date_planned_start': date_planned_start,
            'time_planned_start': time_planned_start,
            'date_planned_end': date_planned_end,
            'time_planned_end': time_planned_end,
            'automation': automation,
            'all_infrastructure_affected': all_infrastructure_affected,
            'maintenance_notify_now': maintenance_notify_now,
            'maintenance_notify_1_hr': maintenance_notify_1_hr,
            'maintenance_notify_24_hr': maintenance_notify_24_hr,
            'maintenance_notify_72_hr': maintenance_notify_72_hr
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #31
0
    def IncidentCreate(self,
                       statuspage_id,
                       components,
                       containers,
                       incident_name,
                       incident_details,
                       current_status,
                       current_state,
                       notify_email=0,
                       notify_sms=0,
                       notify_webhook=0,
                       social=0,
                       irc=0,
                       hipchat=0,
                       slack=0,
                       all_infrastructure_affected=0):
        """Create a new incident.

           Args:
             statuspage_id:
               Status page ID
             components:
               ID of each affected component
             containers:
               ID of each affected container
             incident_name:
               A descriptive title for the incident
             incident_details:
               Message describing this incident
             current_status:
               The status of the components and containers affected by this incident
             current_state:
               The state of this incident
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/incident/create' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'components': components,
            'containers': containers,
            'incident_name': incident_name,
            'incident_details': incident_details,
            'current_status': current_status,
            'current_state': current_state,
            'notify_email': notify_email,
            'notify_sms': notify_sms,
            'notify_webhook': notify_webhook,
            'social': social,
            'irc': irc,
            'hipchat': hipchat,
            'slack': slack,
            'all_infrastructure_affected': all_infrastructure_affected
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #32
0
    def MetricUpdate(self,
                     statuspage_id,
                     metric_id,
                     day_avg,
                     day_start,
                     day_dates,
                     day_values,
                     week_avg,
                     week_start,
                     week_dates,
                     week_values,
                     month_avg,
                     month_start,
                     month_dates,
                     month_values):
        """Update custom metric data

           Args:
             statuspage_id:
               Status page ID
             metric_id:
               Metric ID
             day_avg:
               Average value for past 24 hours
             day_start:
               UNIX timestamp for start of metric timeframe
             day_dates:
               An array of timestamps for the past 24 hours (2014-03-28T05:43:00+00:00)
             day_values:
               An array of values matching the timestamps (Must be 24 values)
             week_avg:
               Average value for past 7 days
             week_start:
               UNIX timestamp for start of metric timeframe
             week_dates:
               An array of timestamps for the past 7 days (2014-03-28T05:43:00+00:00)
             week_values:
               An array of values matching the timestamps (Must be 7 values)
             month_avg:
               Average value for past 30 days
             month_start:
               UNIX timestamp for start of metric timeframe
             month_dates:
               An array of timestamps for the past 30 days (2014-03-28T05:43:00+00:00)
             month_values:
               An array of values matching the timestamps (Must be 30 values)

           Returns:
             A JSON object.
        """
        url = '%s/metric/update' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'metric_id': metric_id,
            'day_avg': day_avg,
            'day_start': day_start,
            'day_dates': day_dates,
            'day_values': day_values,
            'week_avg': week_avg,
            'week_start': week_start,
            'week_dates': week_dates,
            'week_values': week_values,
            'month_avg': month_avg,
            'month_start': month_start,
            'month_dates': month_dates,
            'month_values': month_values
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #33
0
    def MaintenanceSchedule(self,
                            statuspage_id,
                            infrastructure_affected,
                            maintenance_name,
                            maintenance_details,
                            date_planned_start,
                            time_planned_start,
                            date_planned_end,
                            time_planned_end,
                            message_subject,
                            automation="0",
                            all_infrastructure_affected="0",
                            maintenance_notify_now="0",
                            maintenance_notify_1_hr="0",
                            maintenance_notify_24_hr="0",
                            maintenance_notify_72_hr="0"):
        """Schedule a new maintenance

           Args:
             statuspage_id:
               Status page ID
             infrastructure_affected:
               ID of each affected component and container combo
             maintenance_name:
               A descriptive title for this maintenance
             maintenance_details:
               Message describing this maintenance
             date_planned_start:
               Date maintenance is expected to start
             time_planned_start:
               Time maintenance is expected to start
             date_planned_end:
               Date maintenance is expected to end
             time_planned_end:
               Time maintenance is expected to end
             message_subject:
               The message subject for email notifications
             automation:
               Automatically start and end the maintenance (default = 0)
             all_infrastructure_affected:
               Affect all components and containers (default = 0)
             maintenance_notify_now:
               Notify subscribers now (1 = Send notification)
             maintenance_notify_1_hr:
               Notify subscribers 1 hour before scheduled maintenance start time (1 = Send notification)
             maintenance_notify_24_hr:
               Notify subscribers 24 hours before scheduled maintenance start time (1 = Send notification)
             maintenance_notify_72_hr:
               Notify subscribers 72 hours before scheduled maintenance start time (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/maintenance/schedule' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'infrastructure_affected': infrastructure_affected,
                'maintenance_name': maintenance_name,
                'maintenance_details': maintenance_details,
                'date_planned_start': date_planned_start,
                'time_planned_start': time_planned_start,
                'date_planned_end': date_planned_end,
                'time_planned_end': time_planned_end,
                'automation': automation,
                'all_infrastructure_affected': all_infrastructure_affected,
                'maintenance_notify_now': maintenance_notify_now,
                'maintenance_notify_1_hr': maintenance_notify_1_hr,
                'maintenance_notify_24_hr': maintenance_notify_24_hr,
                'maintenance_notify_72_hr': maintenance_notify_72_hr,
                'message_subject': message_subject
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #34
0
    def IncidentResolve(self,
                        statuspage_id,
                        incident_id,
                        incident_details,
                        current_status,
                        current_state,
                        message_subject,
                        notify_email="0",
                        notify_sms="0",
                        notify_webhook="0",
                        social="0",
                        irc="0",
                        hipchat="0",
                        slack="0"):
        """Resolve an existing incident. The incident will be shown in the history instead of on the main page.

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Incident ID
             incident_details:
               Message describing this incident
             current_status:
               The status of the components and containers affected by this incident
             current_state:
               The state of this incident
             message_subject
               The message subject for email notifications
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/incident/resolve' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'incident_id': incident_id,
                'incident_details': incident_details,
                'current_status': current_status,
                'current_state': current_state,
                'notify_email': notify_email,
                'notify_sms': notify_sms,
                'notify_webhook': notify_webhook,
                'social': social,
                'irc': irc,
                'hipchat': hipchat,
                'slack': slack,
                'message_subject': message_subject
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #35
0
    def IncidentCreate(self,
                       statuspage_id,
                       infrastructure_affected,
                       incident_name,
                       incident_details,
                       current_status,
                       current_state,
                       message_subject,
                       notify_email="0",
                       notify_sms="0",
                       notify_webhook="0",
                       social="0",
                       irc="0",
                       hipchat="0",
                       slack="0",
                       all_infrastructure_affected="0"):
        """Create a new incident.

           Args:
             statuspage_id:
               Status page ID
             infrastructure_affected:
               ID of each affected component and container combo
             all_infrastructure_affected:
               Include all components and containers
             incident_name:
               A descriptive title for the incident
             incident_details:
               Message describing this incident
             current_status:
               The status of the components and containers affected by this incident
             current_state:
               The state of this incident
             message_subject:
               The message subject for email notifications
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/incident/create' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'infrastructure_affected': infrastructure_affected,
                'incident_name': incident_name,
                'incident_details': incident_details,
                'current_status': current_status,
                'current_state': current_state,
                'notify_email': notify_email,
                'notify_sms': notify_sms,
                'notify_webhook': notify_webhook,
                'social': social,
                'irc': irc,
                'hipchat': hipchat,
                'slack': slack,
                'all_infrastructure_affected': all_infrastructure_affected,
                'message_subject': message_subject
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #36
0
    def IncidentResolve(self,
                        statuspage_id,
                        incident_id,
                        incident_details,
                        current_status,
                        current_state,
                        notify_email=0,
                        notify_sms=0,
                        notify_webhook=0,
                        social=0,
                        irc=0,
                        hipchat=0,
                        slack=0):
        """Resolve an existing incident. The incident will be shown in the history instead of on the main page.

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Incident ID
             incident_details:
               Message describing this incident
             current_status:
               The status of the components and containers affected by this incident
             current_state:
               The state of this incident
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/incident/resolve' % self.base_url
        resp = self._RequestUrl(url, 'POST', {
            'statuspage_id': statuspage_id,
            'incident_id': incident_id,
            'incident_details': incident_details,
            'current_status': current_status,
            'current_state': current_state,
            'notify_email': notify_email,
            'notify_sms': notify_sms,
            'notify_webhook': notify_webhook,
            'social': social,
            'irc': irc,
            'hipchat': hipchat,
            'slack': slack
        })
        data = json.loads(resp.content.decode('utf-8'))
        return data
Example #37
0
    def IncidentUpdate(self,
                       statuspage_id,
                       incident_id,
                       incident_details,
                       current_status,
                       current_state,
                       notify_email=0,
                       notify_sms=0,
                       notify_webhook=0,
                       social=0,
                       irc=0,
                       hipchat=0,
                       slack=0):
        """Update an existing incident

           Args:
             statuspage_id:
               Status page ID
             incident_id:
               Incident ID
             incident_details:
               Message describing this incident
             current_status:
               The status of the components and containers affected by this incident
             current_state:
               The state of this incident
             notify_email:
               Notify email subscribers (1 = Send notification)
             notify_sms:
               Notify SMS subscribers (1 = Send notification)
             notify_webhook:
               Notify webhook subscribers (1 = Send notification)
             social:
               Automatically Tweet this update. (1 = Send Tweet)
             irc:
               Notify IRC channel (1 = Send notification)
             hipchat:
               Notify HipChat room (1 = Send notification)
             slack:
               Notify Slack channel (1 = Send notification)

           Returns:
             A JSON object.
        """
        url = '%s/incident/update' % self.base_url
        resp = self._RequestUrl(
            url, 'POST', {
                'statuspage_id': statuspage_id,
                'incident_id': incident_id,
                'incident_details': incident_details,
                'current_status': current_status,
                'current_state': current_state,
                'notify_email': notify_email,
                'notify_sms': notify_sms,
                'notify_webhook': notify_webhook,
                'social': social,
                'irc': irc,
                'hipchat': hipchat,
                'slack': slack
            })
        data = json.loads(resp.content.decode('utf-8'))
        return data