service_class Class Reference

A service runs on a host or a hostgroup. More...

Inheritance diagram for service_class:
object_class service_template_class

Public Member Functions

 get_fellow_slaves ()
 Fetches a list of all objects sharing the same master object.
 validate_object ()
 Validates an object by calling the parent function, as well as making sure no host gets two services with the same service_description assigned to it.
 get_object_by_name ($name)
 Loads a service-object based on its Nagios-name.
 denormalize ($obj=false)
 Takes the any given object (or the current one) and makes it denormalized.
 save_object ($user=true)
 Writes the $this->obj to the database if it validates properly.
 get_cmd_bar_links ()
 Returns a list of actions that are legal for this object type.
 get_nagios_struct ($prefix='')
 Export with naming and values to map nagios struct names ond format.

Static Public Member Functions

static get_parent_type ($id)
 Given a preexisting service id, returns the type of the parent object.

Data Fields

 $type = 'service'
 type of the object
 $master_obj_type = 'host'
 The type of object services must live 'under'.
 $master_obj_candidates = array('host' => 'host_name', 'hostgroup' => 'hostgroup_name')
 If there are several possible master object types for this object, list them here.
 $master_obj_identifier = 'host_name'
 variable key identifying our 'master' object
 $master_obj_id = false
 The numerical value of the host which is our 'master'.
 $nagios_defaults
 What Nagios considers default options.
 $slave_types
 A list of object types that might depend on this object type, or false.

Detailed Description

A service runs on a host or a hostgroup.

The term "service" is used very loosely. It can mean an actual service that runs on the host (POP, SMTP, HTTP, etc.) or some other type of metric associated with the host (response to a ping, number of logged in users, free disk space, etc.).

To use it on hostgroups in the API, always specify ?parent_type=hostgroup in your calls: https://monitor/api/config/service/a_hostgroup;a_service?parent_type=hostgroup


Member Function Documentation

service_class::denormalize ( obj = false  ) 

Takes the any given object (or the current one) and makes it denormalized.

That is, objects are normally stored in 3rd normal form (with id values instead of actual names to other objects). This function takes a normalized object and returns a denormalized one with all ids expanded to their proper names.

Exceptions:
NacomaRelationException 

Reimplemented from object_class.

service_class::get_fellow_slaves (  ) 

Fetches a list of all objects sharing the same master object.

Returns:
An array of service_id => service_description entries

Reimplemented from object_class.

service_class::get_nagios_struct ( prefix = ''  ) 

Export with naming and values to map nagios struct names ond format.

Useful for Test this x operation

Reimplemented from object_class.

service_class::get_object_by_name ( name  ) 

Loads a service-object based on its Nagios-name.

Returns:
The loaded object, or false on failures

Reimplemented from object_class.

service_class::save_object ( user = true  ) 

Writes the $this->obj to the database if it validates properly.

Parameters:
$user false if this change isn't made by a user. If not, no validation will be performed, and the change won't show up in the changelog.
Returns:
true if everything worked out ok; false if not.

Reimplemented from object_class.


Field Documentation

service_class::$nagios_defaults
Initial value:
                array('stalking_options' => array('n' => ''),
                      'notification_options' => array('n' => ''),
                      'flap_detection_options' => array('o' => 1, 'c' => 1, 'w' => 1, 'u' => 1),
                      'parallelize_check' => '1',
                      'obsess' => '1',
                      'check_freshness' => '0',
                      )

What Nagios considers default options.

Reimplemented from object_class.

service_class::$slave_types
Initial value:
 array(
                'serviceextinfo',
                'serviceescalation',
                'servicedependency')

A list of object types that might depend on this object type, or false.

Reimplemented from object_class.

Reimplemented in service_template_class.


The documentation for this class was generated from the following file:
 All Data Structures Functions Variables

Generated on 22 Apr 2013 for nacoma by  doxygen 1.6.1