3 include_once
'includes/nagios.inc';
26 if ((
int)DRUSH_VERSION > 5) {
27 $doc_prefix = drush_get_context(
'DOC_PREFIX');
28 include_once $doc_prefix .
'/commands/pm/updatestatus.pm.inc';
42 Exit status, returned severities:
44 * NAGIOS_OK (0) - if monitored Drupal site is up to date
45 * NAGIOS_WARNING (1) - if there is a code (core, contrib and theme), pending database update available
46 or unmet Drupal requirements with severity \'REQUIREMENT_WARNING\'(1)
47 * NAGIOS_CRITICAL(2) - if there is a code update with severity \'Security update\' available
48 or unmet Drupal requirements with severity \'REQUIREMENT_ERROR\'(2)
51 case 'meta:nagios:title':
52 return dt(
'Nagios commands');
53 case 'drush:check-updates':
54 $help = dt(
'Checks a Drupal site for code (core and contrib) updates.');
55 return $help . $help_header;
57 case 'drush:check-db-updates':
58 $help = dt(
'Checks a Drupal site for pending database updates.');
59 return $help . $help_header;
73 $items[
'check-updates'] = array(
74 'callback' =>
'drush_nagios_updates',
75 'description' =>
'For the usage as nagios plugin: Monitores a Drupal site and print a message and return with an exit status.',
76 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
78 'drush @example check-updates' =>
'/path/to/drupal/sites/default: UPDATES: admin_menu,ckeditor,ckeditor_link,conditional_fields,date,devel,devel_themer,entity,features,field_collection,link,menu_attributes,menu_link,references,transliteration,views_datasource,webform SECURITY UPDATES: ctools,email',
79 'drush @example check-updates --ignore=ctools,email' =>
'/path/to/drupal/sites/default: UPDATES: admin_menu,ckeditor,ckeditor_link,conditional_fields,date,devel,devel_themer,entity,features,field_collection,link,menu_attributes,menu_link,references,transliteration,views_datasource,webform IGNORED BY SETTINGS: ctools(SECURITY UPDATE available),email(SECURITY UPDATE available)',
83 'description' =>
'Project or comma seperated list of projects which should be ignored.',
84 'value' =>
'required',
85 'example-value' =>
'ctools,email',
87 'ignore-locked' => array(
88 'description' =>
'Ignore projects which are locked by drush pm-update --lock.',
106 $items[
'check-db-updates'] = array(
107 'callback' =>
'drush_nagios_updates',
108 'description' =>
'Checks for pending database updates.',
109 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_SITE,
111 'drush @example check-db-updates' =>
'\'/path/to/drupal/sites/
default: has pending database updates, run \
'drush updatedb\' or visit update.php in your browser for more details.\' with exit status 1',
126 $items[
'check-drupal-requirements'] = array(
127 'callback' =>
'drush_nagios_updates',
128 'description' =>
'Checks for anything under Drupals status report.',
129 'bootstrap' => DRUSH_BOOTSTRAP_DRUPAL_FULL,
132 'description' =>
'Facility or comma seperated list of facilities which should be ignored,',
133 'value' =>
'required',
134 'example-value' =>
'unicode',
156 $command = drush_get_command();
157 if ($command[
'command'] ==
'check-db-updates') {
160 else if ($command[
'command'] ==
'check-updates') {
164 else if ($command[
'command'] ==
'check-drupal-requirements') {
169 drush_set_context(
'DRUSH_EXECUTION_COMPLETED', TRUE);
_nagios_exit_status($parsed_update_info)
_nagios_print_message($parsed_update_info)
_nagios_parse_drupal_status_info($requirements)
_nagios_get_update_info()
_nagios_get_db_update_info()
nagios_drush_help($section)
_nagios_get_drupal_status_info()
_nagios_parse_update_info($update_info)