Let’s start with a graphic representation of the model...
The models module defines the nagios configuration datastructures as classes.
For obvious reasons you should also check the Nagios documentation for the attributes. Each attribute has been named as the configuration option in nagios. example:
define command {
command_name com1
command_line line1
}
The previous example is a basic definition of the command object in nagios. We mapped this to the following api:
>>> com = Command()
>>> com.command_name = 'com1'
>>> com.command_line = 'line1'
Where we could we would link to another object. example:
define contactgroup {
contactgroup_name cg1
alias Contact group 1
members admins,nagios
}
To map this example we can link the members section to a list of Contact objects. This would be done with a many to many relationship. This resulted in following api:
>>> cg = ContactGroup()
>>> cg.contactgroup_name = 'cg1'
>>> cg.alias = 'Contact group 1'
>>> cg.save()
>>> cg.members.add(Contact.get('admins'))
>>> cg.members.add(Contact.get('nagios'))
As you can see we saved before adding a member. This is to be able to save the many to many references correctly. So as long as the object has no ID we cannot add many to many relations.
Abstract class for all NagiosObjects
Basicly get() will fetch the information from the database, export() will export the object to a nagios configuration string
deserialize() allows you to import data you received into the database. deserialize() will first check whether the data can be imported, else it throws an error.
| Parameters: |
|
|---|---|
| Rtype type: | str |
Classmethod get() should always provide a way to fetch an object from the database by providing on of the key values. Returns the object or raises an error if no object with that criterion has been found
| Parameter: | criterion (str) – Criterion to fetch the object |
|---|---|
| Return type: | NagiosObject |
| Raises: | DoesNotExist |
Each NagiosObject should provide a way to parse the object to a string containing the nagios configuration block.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
serializers in django. Right now we can serialize to following formats:
- json
- python
- xml
- yaml
For more information on the serializers in django please visit: http://docs.djangoproject.com/en/dev/topics/serialization/
param type: Type of the serialization default set to python type type: str return str: String containing the the serialized information
Host is the class that defines the nagios host model. It uses foreign keys and many2many relationships to have a basic validation and control. At this time Django does not support validation for attributes so this will be included later.
Before you can start assigning m2m relations you need to save the object first. Make sure you add a host_name or name before saving. This to allow you to fetch the host easily:
>>> from djagios.core.models import Host
>>> host = Host()
>>> host.host_name="host01"
>>> host.save()
| parent: | NagiosObject |
|---|
classmethod that will allow you to fetch a Host object from the database.
>>> h = host.get('nagios1')
>>> type(h)
<class 'djagios.core.models.Host'>
>>> h.host_name
nagios1
| Parameter: | criterion (str) – criterion you wish to supply, for Host this is host_name or name |
|---|---|
| Return type: | Host or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current Host object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
Specifies the template to be used for this Host.
db: django.db.models.ForeignKey, Host, H_use_H, blank=True, null=True
name is used to specify the name of this Host template.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to define a short name used to identify the Host. It is used in HostGroup and Service definitions to reference this particular Host.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to define a longer name or description used to identify the Host. It is provided in order to allow you to more easily identify a particular Host.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to define the address of the host. Normally, this is an IP address, although it could really be anything you want (so long as it can be used to check the status of the host).
db: django.db.models.CharField 255
This directive is used to define a comma-delimited list of short names of the “parent” Host objects for this particular Host.
db: django.db.models.ManyToManyField, Host, H_parents_H
This directive is used to identify the short name(s) of the :class:’HostGroup` objects that the Host belongs to. Multiple HostGroup objects should be separated by commas.
db: django.db.models.ManyToManyField, HostGroup, H_hg_HG
This directive is used to specify the short name of the Command that should be used to check if the Host is up or down.
db: django.db.models.ForeignKey, Command, H_cc_C
This directive is used to specify the short name of the TimePeriod during which active checks of this Host can be made.
db: django.db.models.ManyToManyField, TimePeriod, H_cp_TP
By default Nagios will assume that all Host objects are in UP states when it starts. You can override the initial state for a Host by using this directive. Valid options are: o = UP, d = DOWN, and u = UNREACHABLE. Default we set ‘d’.
db: django.db.models.CharField 1, default=’d’
This directive is used to define the number of times that Nagios will retry the Host check Command if it returns any state other than an OK state.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to define the number of “time units” between regularly scheduled checks of the Host.
db: django.db.models.IntegerField, blank=True, null=True
This directive is used to define the number of “time units” to wait before scheduling a re-check of the Hosts. Host objects are rescheduled at the retry interval when they have changed to a non-UP state.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to determine whether or not active checks (either regularly scheduled or on-demand) of this Host are enabled. Values: 0 = disable active host checks, 1 = enable active host checks (default).
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not passive checks are enabled for this Host. Values: 0 = disable passive host checks, 1 = enable passive host checks (default).
db: django.db.models.NullBooleanField, blank=True,null=True
This directive determines whether or not checks for the Host will be “obsessed” over using the NagiosCfg.ochp_command.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not freshness checks are enabled for this Host. Values: 0 = disable freshness checks, 1 = enable freshness checks (default).
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the freshness threshold (in seconds) for this Host. If you set this directive to a value of 0, Nagios will determine a freshness threshold to use automatically.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to specify the short name of the Command that should be run whenever a change in the state of the Host is detected (i.e. whenever it goes down or recovers).
db: django.db.models.ForeignKey, Command, H_eh_C, blank=True, null=True
This directive is used to determine whether or not the Host.event_handler for this Host is enabled. Values: 0 = disable host event handler, 1 = enable host event handler..
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the low state change threshold used in flap detection for this Host.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to specify the high state change threshold used in flap detection for this Host.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to determine whether or not flap detection is enabled for this Host.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine what host states the flap detection logic will use for this Host. Valid options are a combination of one or more of the following: o = UP states, d = DOWN states, u = UNREACHABLE states.
db: django.db.models.CharField 10, blank=True,null=True
This directive is used to determine whether or not the processing of performance data is enabled for this Host.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not status-related information about the Host is retained across program restarts.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not non-status information about the Host is retained across program restarts.
db: django.db.models.NullBooleanField, blank=True,null=True
This is a list of the short names of the Contact objects that should be notified whenever there are problems (or recoveries) with this Host. Multiple Contact objects should be separated by commas.
db: django.db.models.ManyToManyField, Contact, H_c_C, blank=True,null=True
This is a list of the short names of the ContactGroup objects that should be notified whenever there are problems (or recoveries) with this Host. Multiple :class:ContactGroup` objects should be separated by commas.
db: django.db.models.ManyToManyField, ContactGroup, H_cg_CG, blank=True, null=True
This directive is used to define the number of “time units” to wait before re-notifying a Contact that this Host is still down or unreachable. Unless you’ve changed the NagiosCfg.interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will not re-notify contacts about problems for this Host - only one problem notification will be sent out.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to define the number of “time units” to wait before sending out the first problem notification when this Host enters a non-UP state. Unless you’ve changed the NagiosCfg.interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will start sending out notifications immediately.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to specify the TimePeriod during which notifications of events for this Host can be sent out to Host.contacts.
db: django.db.models.ForeignKey, TimePeriod, H_np_TP, blank=True,null=True
This directive is used to determine when notifications for the Host should be sent out. Valid options are a combination of one or more of the following: d = send notifications on a DOWN state, u = send notifications on an UNREACHABLE state, r = send notifications on recoveries (OK state), f = send notifications when the host starts and stops flapping, and s = send notifications when scheduled downtime starts and ends. If you specify n (none) as an option, no Host notifications will be sent out.
db: django.db.models.CharField 20, blank=True,null=True
This directive is used to determine whether or not notifications for this Host are enabled.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive determines which Host states “stalking” is enabled for. Valid options are a combination of one or more of the following: o = stalk on UP states, d = stalk on DOWN states, and u = stalk on UNREACHABLE states.
db: django.db.models.CharField 10, blank=True,null=True
Definition for the Nagios hostgroup object.
classmethod that will allow you to fetch a HostGroup object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for HostGroup this is the hostgroup_name |
|---|---|
| Return type: | HostGroup or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current HostGroup object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
This directive is used to define a short name used to identify the HostGroup.
db: django.db.models.CharField 255, unique=True
This directive is used to define is a longer name or description used to identify the HostGroup. It is provided in order to allow you to more easily identify a particular HostGroup.
db: django.db.models.CharField 255, blank=True, null=True
This is a list of the Host objects that should be included in this HostGroup.
db: django.db.models.ManyToManyField, Host, HG_m_H, blank=True,null=True
This optional directive can be used to include hosts from other “sub” host groups in this HostGroup.
db: django.db.models.ManyToManyField, HostGroup, HG_hgm_HG, blank=True,null=True
This directive is used to define an optional string of notes pertaining to the HostGroup.
db: django.db.models.TextField, blank=True, null=True
This variable is used to define an optional URL that can be used to provide more information about the HostGroup.
db: django.db.models.URLField, blank=True, null=True
This directive is used to define an optional URL that can be used to provide more actions to be performed on the HostGroup.
db: django.db.models.URLField, blank=True, null=True
Service is the class that defines the Nagios service object.
classmethod that will allow you to fetch a :class:Service` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for Service this is the service_description or name |
|---|---|
| Return type: | Service or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current Service object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
Specifies the template to be used for this Service.
db: django.db.models.ForeignKey, Service, S_use_S*
Used to specify the name of this Service template.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to specify the Host object(s) that the Service “runs” on or is associated with.
db: django.db.models.ManyToManyField, Host, S_hostname_H, blank=True, null=True
This directive is used to specify the HostGroup object(s) that the Service “runs” on or is associated with. The hostgroup_name may be used instead of, or in addition to, the host_name directive.
db: django.db.models.ManyToManyField, HostGroup, H_hostgroup_HG, blank=True, null=True
This directive is used to specify the Host object(s) that are negated (thus must be excluded) in host_name.
db: django.db.models.ManyToManyField, Host, S_hostname_n_H, blank=True, null=True
This directive is used to specify the HostGroup object(s) that are negated (thus must be excluded) in hostgroup_name_n.
db: django.db.models.ManyToManyField, HostGroup, H_hostgroup_n_HG, blank=True, null=True
This directive is used to define the description of the Service, which may contain spaces, dashes, and colons (semicolons, apostrophes, and quotation marks should be avoided). No two Service objects associated with the same Host can have the same description. Service objects are uniquely identified with their host_name and service_description directives.
db: django.db.models.CharField 255*
This directive is used to define an alternate name that should be displayed in the web interface for this Service.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to identify the short name(s) of the ServiceGroup object(s) that the Service belongs to.
db: django.db.models.ManyToManyField, ServiceGroup, S_sg_SG, blank=True, null=True
This directive is used to denote whether the Service is “volatile”. Services are normally not volatile.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the short name of the Command that Nagios will run in order to check the status of the Service.
db: django.db.models.ForeignKey, Command, S_cc_CMD*
By default Nagios will assume that all services are in OK states when it starts. You can override the initial state for a Service by using this directive. Valid options are: o = OK, w = WARNING, u = UNKNOWN, and c = CRITICAL.
db: django.db.models.CharField 1, blank=True, null=True
This directive is used to define the number of times that Nagios will retry the check_command if it returns any state other than an OK state.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to define the number of “time units” to wait before scheduling the next “regular” check of the Service.
db: django.db.models.IntegerField, blank=True, null=True
This directive is used to define the number of “time units” to wait before scheduling a re-check of the Service. Services are rescheduled at the retry interval when they have changed to a non-OK state.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to determine whether or not active checks of this Service are enabled. Values: 0 = disable active service checks, 1 = enable active service checks (default).
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not passive checks of this Service are enabled. Values: 0 = disable passive service checks, 1 = enable passive service checks (default).
db: django.db.models.NullBooleanField, blank=True,null=True
This directive determines whether or not checks for the Service will be “obsessed” over using the NagiosCfg.ocsp_command.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the TimePeriod during which active checks of this Service can be made.
db: django.db.models.ManyToManyField, Service, S_cp_TP*
This directive is used to determine whether or not freshness checks are enabled for this Service.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the freshness threshold (in seconds) for this Service.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to specify the Command that should be run whenever a change in the state of the Service is detected (i.e. whenever it goes down or recovers).
db: django.db.models.ForeignKey, Command, S_eh_C, blank=True, null=True
This directive is used to determine whether or not the event_handler for this Service is enabled.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the low state change threshold used in flap detection for this Service.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to specify the high state change threshold used in flap detection for this Service.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to determine whether or not flap detection is enabled for this Service.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine what service states the flap detection logic will use for this Service.
db: django.db.models.CharField 10, blank=True,null=True
This directive is used to determine whether or not the processing of performance data is enabled for this Service.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not status-related information about the Service is retained across program restarts.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not non-status information about the Service is retained across program restarts.
db: django.db.models.NullBooleanField, blank=True,null=True
This is a list of the Contact that should be notified whenever there are problems (or recoveries) with this Service.
db: django.db.models.ManyToManyField, Contact, S_c_C, blank=True,null=True
This is a list of the ContactGroup objects that should be notified whenever there are problems (or recoveries) with this Service.
db: django.db.models.ManyToManyField, ContactGroup, S_cg_CG, blank=True, null=True
This directive is used to define the number of “time units” to wait before re-notifying a Contact that this Service is still in a non-OK state. Unless you’ve changed the NagiosCfg.interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will not re-notify contacts about problems for this Service - only one problem notification will be sent out.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to define the number of “time units” to wait before sending out the first problem notification when this Service enters a non-OK state. Unless you’ve changed the NagiosCfg.interval_length directive from the default value of 60, this number will mean minutes. If you set this value to 0, Nagios will start sending out notifications immediately.
db: django.db.models.IntegerField, blank=True,null=True
This directive is used to specify the TimePeriod during which notifications of events for this Service can be sent out to contacts.
db: django.db.models.ForeignKey, TimePeriod, S_np_TP, blank=True,null=True
This directive is used to determine when notifications for the Service should be sent out. Valid options are a combination of one or more of the following: w = send notifications on a WARNING state, u = send notifications on an UNKNOWN state, c = send notifications on a CRITICAL state, r = send notifications on recoveries (OK state), f = send notifications when the service starts and stops flapping, and s = send notifications when scheduled downtime starts and ends. If you specify n (none) as an option, no Service notifications will be sent out. If you do not specify any notification options, Nagios will assume that you want notifications to be sent out for all possible states. Example: If you specify w,r in this field, notifications will only be sent out when the Service goes into a WARNING state and when it recovers from a WARNING state.
db: django.db.models.CharField 10, blank=True,null=True
This directive is used to determine whether or not notifications for this Service are enabled.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive determines which Service states “stalking” is enabled for. Valid options are a combination of one or more of the following: o = stalk on OK states, w = stalk on WARNING states, u = stalk on UNKNOWN states, and c = stalk on CRITICAL states.
db: django.db.models.CharField 10, blank=True,null=True
This directive is used to define an optional string of notes pertaining to the Service.
db: django.db.models.TextField, blank=True, null=True
This variable is used to define an optional URL that can be used to provide more information about the Service.
db: django.db.models.URLField, blank=True, null=True
This directive is used to define an optional URL that can be used to provide more actions to be performed on the Service.
db: django.db.models.URLField , blank=True, null=True
Definition for the Nagios servicegroup object.
classmethod that will allow you to fetch a :class:ServiceGroup` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for ServiceGroup this is the servicegroup_name |
|---|---|
| Return type: | ServiceGroup or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current ServiceGroup object.
| Return type: | str |
|---|---|
| Raises: | djagios.core.exceptions.ParseError |
This directive is used to define a short name used to identify the ServiceGroup.
db: django.db.models.CharField 255, unique=True
This directive is used to define is a longer name or description used to identify the ServiceGroup. It is provided in order to allow you to more easily identify a particular ServiceGroup.
db: django.db.models.CharField 255, blank=True, null=True
This is a list of the Service.service_description (and the corresponding Host.host_name) that should be included in this group, separated by commas.
db: django.db.models.TextField, blank=True,null=True
This optional directive can be used to include Host objects from other “sub” ServiceGroup objects in this ServiceGroup.
db: django.db.models.ManyToManyField, HostGroup, SG_sgm_SG, blank=True,null=True
This directive is used to define an optional string of notes pertaining to the ServiceGroup.
db: django.db.models.TextField , blank=True, null=True
This variable is used to define an optional URL that can be used to provide more information about the ServiceGroup.
db: django.db.models.URLField , blank=True, null=True
This directive is used to define an optional URL that can be used to provide more actions to be performed on the ServiceGroup.
db: django.db.models.URLField , blank=True, null=True
Definition for the Nagios contact object
classmethod that will allow you to fetch a :class:Contact` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for Contact this is the name or contact_name |
|---|---|
| Return type: | Contact or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current Contact object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
Specifies the template to be used for this Contact
db: django.dn.models.ForeignKey , C_use_C, blank=True, null=True
name is used to specify the name of this Contact template.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to define a short name used to identify the Contact.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to define a longer name or description for the Contact.
db: django.db.models.CharField 255, blank=True, null=True
This directive is used to identify the ContactGroup object(s) that the Contact belongs to.
db: django.db.models.ManyToManyField, C_cg_CG, blank=True, null=True
This directive is used to determine whether or not the Contact will receive notifications about Host problems and recoveries.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not the Contact will receive notifications about Service problems and recoveries.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to specify the TimePeriod during which the Contact can be notified about Host problems or recoveries.
db: django.db.models.ForeignKey, TimePeriod, C_hnp_TP, blank=True,null=True
This directive is used to specify the TimePeriod during which the Contact can be notified about Service problems or recoveries.
db: django.db.models.ForeignKey, TimePeriod, C_snp_TP, blank=True,null=True
This directive is used to define the Host states for which notifications can be sent out to this Contact. Valid options are a combination of one or more of the following: d = notify on DOWN Host states, u = notify on UNREACHABLE Host states, r = notify on Host recoveries (UP states), f = notify when the Host starts and stops flapping, and s = send notifications when Host or Service scheduled downtime starts and ends. If you specify n (none) as an option, the Contact will not receive any type of Host notifications.
db: django.db.models.CharField, 20
This directive is used to define the Service states for which notifications can be sent out to this Contact. Valid options are a combination of one or more of the following: w = notify on WARNING Service states, u = notify on UNKNOWN Service states, c = notify on CRITICAL Service states, r = notify on Service recoveries (OK states), and f = notify when the Service starts and stops flapping. If you specify n (none) as an option, the Contact will not receive any type of Service notifications.
db: django.db.models.CharField, 20
This directive is used to define a list of Commands used to notify the Contact of a Host problem or recovery.
db: django.db.models.ManyToManyField, Command, C_hnv_CMD, blank=True,null=True
This directive is used to define a list of Commands used to notify the Contact of a Service problem or recovery.
db: django.db.models.ManyToManyField, Command, C_snv_CMD, blank=True,null=True
This directive is used to define an email address for the Contact.
db: django.db.models.emailField, blank=True
This directive is used to define a pager number for the Contact. It can also be an email address to a pager gateway (i.e. pagejoe@pagenet.com).
db: django.db.models.CharField 255, blank=True, null=True
Address directive is used to define additional “addresses” for the Contact.
db: django.db.models.TextField , blank=True
This directive is used to determine whether or not the Contact can submit external commands to Nagios from the CGIs.
db: django.db.models.BooleanrField,default=True, null=True
This directive is used to determine whether or not status-related information about the Contact is retained across program restarts.
db: django.db.models.NullBooleanField, blank=True,null=True
This directive is used to determine whether or not non-status information about the Contact is retained across program restarts.
db: django.db.models.NullBooleanField, blank=True,null=True
Definition for the Nagios contactgroup object
classmethod that will allow you to fetch a :class:ContactGroup` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for ContactGroup this is the contactgroup_name |
|---|---|
| Return type: | ContactGroup or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current ContactGroup object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
This directive is a short name used to identify the ContactGroup.
db: django.db.models.CharField 255, unique=True
This directive is used to define a longer name or description used to identify the ContactGroup.
db: django.db.models.CharField 255, blank=True
This optional directive is used to define a list of Contact that should be included in this group.
db: django.db.models.ManyToManyField, CG_m_C, blank=True, null=True
This optional directive can be used to include Contact objects from other “sub” ContactGroup objects in this ContactGroup.
db: django.db.models.ManyToManyField, CG_cgm_CG, blank=True, null=True
Definition for the Nagios command object
classmethod that will allow you to fetch a :class:Command` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for Command this is the command_name |
|---|---|
| Return type: | Command or None |
| Raises: | DoesNotExist |
As the command_name is usually given with the parameters attached to it, we split on ! and take the first entry of the resulting list. So there is no need to parse the check_command entry before passing to this function.
parse_to_nagios_cfg() will create a nagios formatted block of the current Command object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
This directive is the short name used to identify the Command. It is referenced in Contact, Host, and Service definitions.
db: django.db.models.CharField 255, blank=True
Definition for the Nagios TimePeriod object
Ths TimePeriod object is a special object. Nagios allows to configure ranges. As the key of a range is chosen by the admin we cannot foresee columns with their names. Thus we parse the ranges into TimeRange objects and link them to this object.
There are also multiple excludes possible, each exclude is a reference to a TimePeriod.
classmethod that will allow you to fetch a :class:TimePeriod` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for TimePeriod this is the timeperiod_name |
|---|---|
| Return type: | TimePeriod or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current TimePeriod object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
This directive is the short name used to identify the TimePeriod.
db: django.db.models.CharField 255, unique=True
This directive is a longer name or description used to identify the TimePeriod
db: django.db.models.CharField 255
This directive holds the weekdays attribute of Nagios. It defines different time ranges that apply on the TimePeriod. There must be at least one TimeRange defined.
db django.db.models.ManyToManyField, TimeRange, TP_r_TR,
This directive is used to specify other TimePeriod definitions whose time ranges should be excluded from this TimePeriod.
db django.db.models.ManyToManyField, TimePeriod, TP_e_TP,
A helper class for the TimePeriod object
By creating a key-value pair object we can simply add the TimeRange to the TimePeriod for the [weekdays] and [exceptions] directives. Nagios allows those directives to have a unique key. This was the only way to solve it from a database viewpoint.
This attribute contains the weekday or exception key for the TimePeriod object.
db: django.db.models.CharField 255, unique=True
This attribute contains range for the key from the TimePeriod object.
db: django.db.models.CharField 255
Definition for the Nagios servicedependency object.
classmethod that will allow you to fetch a :class:ServiceDependency` object from the database.
| Parameter: | criterion (str) – criterion you wish to supply, for ServiceDependency this is the service_description |
|---|---|
| Return type: | ServiceDependency or None |
| Raises: | DoesNotExist |
parse_to_nagios_cfg() will create a nagios formatted block of the current ServiceDependency object.
| Parameter: | path (str) – Optional, allows to pass the dir where the file will be written. |
|---|---|
| Return type: | str |
| Raises: | djagios.core.exceptions.ParseError |
This attribute defines the Host objects that the dependent service runs on or is associated with.
db: django.db.models.ManyToManyField, SD_dh_H, blank=True, null=True
This attribute defines the HostGroup objects that the dependent service runs on or is associated with.
db: django.db.models.ManyToManyField, SD_dgh_HG, blank=True, null=True
This attribute defines the dependent Service.
db: django.db.models.ForeignKey, SD_ds_S, blank=False, null=False
This attribute contains a list of Host objects that ServiceDependency depends on.
db: django.db.models.ManyToManyField, SD_hn_H, blank=True, null=True
This attribute contains a list of HostGroup objects that ServiceDependency depends on.
db: django.db.models.ManyToManyField, SD_hgn_HG, blank=True, null=True
This attribute contains the Service that ServiceDependency depends on.
db: django.db.models.ForeignKey, SD_s_S, blank=False, null=False
This attribute specifies whether the dependency inherits the dependencies of the service it depends on.
db: django.db.models.NullBooleanField, default=False
This attribute is used to specify the criteria that determine when the dependent service should not be actively checked. If the master service is in one of the failure states we specify, the dependent service will not be actively checked.
db: django.db.models.CharField, max_length=10
This attribute is used to specify the criteria that determine when inotifications for the dependent service should not be sent out. If the master service is in one of the failure states we specify, notifications for the dependent service will not be sent out.
db: django.db.models.CharField, max_length=10
This directive is used to specify the TimePeriod during which this dependency is valid. If this directive is not specified, the dependency is considered to be valid during all times.
db: django.db.models.ForeignKey, TimePeriod, SD_dp_TP, blank=True,null=True