You are here

nagios.install in Nagios Monitoring 6

Same filename and directory in other branches
  1. 5 nagios.install
  2. 7 nagios.install

File

nagios.install
View source
<?php

// Copyright 2009 Khalid Baheyeldin http://2bits.com
function nagios_uninstall() {
  variable_del('nagios_updates');
  variable_del('nagios_ua');
  variable_del('nagios_enable_status_page');
  variable_del('nagios_show_outdated_names');
  variable_del('nagios_status_ok_value');
  variable_del('nagios_status_warning_value');
  variable_del('nagios_status_critical_value');
  variable_del('nagios_status_unknown_value');
}

/**
 * Implementation of hook_requirements().
 */
function nagios_requirements($phase) {
  $requirements = array();
  if ($phase == 'runtime') {

    // Raise warning if Nagios Unique ID has not been set yet.
    if (variable_get('nagios_ua', '') == '') {
      $requirements['nagios'] = array(
        'title' => t('Nagios module'),
        'value' => t('Not configured'),
        'description' => t('Nagios module has not been configured yet. Please configure its settings from the <a href="@url">Nagios settings page</a>.', array(
          '@url' => url('admin/settings/nagios'),
        )),
        'severity' => REQUIREMENT_WARNING,
      );
    }
  }
  return $requirements;
}

/**
 * Setting Nagios status values to original declared defaults.
 */
function nagios_update_6100() {
  $return_message = array();
  variable_set('nagios_status_ok_value', 0);
  variable_set('nagios_status_unknown_value', 1);
  variable_set('nagios_status_warning_value', 2);
  variable_set('nagios_status_critical_value', 3);
  $return_message[] = array(
    'success' => true,
    'query' => 'Set variables so Nagios status values are set to old settings on update.',
  );
  return $return_message;
}

Functions

Namesort descending Description
nagios_requirements Implementation of hook_requirements().
nagios_uninstall
nagios_update_6100 Setting Nagios status values to original declared defaults.