Exemple #1
0
 class Meta:
     if not db_limit_1():
         # not present in oracle DBs
         unique_together = [("width", "height")]
     ordering = (
         "width",
         "height",
     )
Exemple #2
0
class mon_icinga_log_raw_service_alert_data(mon_icinga_log_raw_base):
    STATE_OK = "O"
    STATE_WARNING = "W"
    STATE_CRITICAL = "C"
    STATE_CHOICES = [
        (STATE_OK, "OK"),
        (STATE_WARNING, "WARNING"),
        (mon_icinga_log_raw_base.STATE_UNKNOWN,
         mon_icinga_log_raw_base.STATE_UNKNOWN_LONG),
        (STATE_CRITICAL, "CRITICAL"),
        (mon_icinga_log_raw_base.STATE_UNDETERMINED,
         mon_icinga_log_raw_base.STATE_UNDETERMINED_LONG),
        (mon_icinga_log_raw_base.STATE_PLANNED_DOWN,
         mon_icinga_log_raw_base.STATE_PLANNED_DOWN_LONG),
    ]
    STATE_CHOICES_REVERSE_MAP = {val: key for (key, val) in STATE_CHOICES}

    objects = raw_service_alert_manager()

    # NOTE: there are different setup, at this time only regular check_commands are supported
    # they are identified by the mon_check_command.pk and their name, hence the fields here
    # the layout of this table probably has to change in order to accommodate for further services
    # I however can't do that now as I don't know how what to change it to
    service = models.ForeignKey(
        mon_check_command, null=True,
        db_index=True)  # null for device_independent events
    if db_limit_1():
        service_info = models.TextField(blank=True, null=True)
    else:
        service_info = models.TextField(blank=True, null=True, db_index=True)

    state_type = models.CharField(max_length=2,
                                  choices=mon_icinga_log_raw_base.STATE_TYPES)
    state = models.CharField(max_length=2, choices=STATE_CHOICES)

    # whether this is an entry at the beginning of a fresh archive file.
    log_rotation_state = models.BooleanField(default=False)
    # whether this is an entry after icinga restart
    initial_state = models.BooleanField(default=False)

    class CSW_Meta:
        backup = False
Exemple #3
0
 class Meta:
     if not db_limit_1():
         unique_together = [("user", "name")]
Exemple #4
0
 class Meta:
     if db_limit_1():
         pass
     else:
         unique_together = ("obj_pk", "model")