You are here

function nagios_check_users in Nagios Monitoring 8

Same name and namespace in other branches
  1. 5 nagios.module \nagios_check_users()
  2. 6 nagios.module \nagios_check_users()
  3. 7 nagios.module \nagios_check_users()

Report the number of active user accounts.

Return value

array

File

./nagios.module, line 766
Main file for Nagios service monitoring.

Code

function nagios_check_users() {

  // Include number of active users in the report.
  $connection = Drupal::database();
  $count = (int) $connection
    ->query("SELECT COUNT(*) FROM {users_field_data} WHERE status = 1")
    ->fetchField();
  $data = [
    'status' => NAGIOS_STATUS_OK,
    'type' => 'perf',
    'text' => $count,
  ];
  return [
    'key' => 'USR',
    'data' => $data,
  ];
}