You are here

function nagios_check_session_auth in Nagios Monitoring 7

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

Report the number of logged in sessions.

Return value

array

File

./nagios.module, line 1073

Code

function nagios_check_session_auth() {
  $interval = REQUEST_TIME - 900;

  // Last 15 minutes
  $count = (int) db_query("SELECT COUNT(*) FROM {sessions} WHERE timestamp >= :timestamp AND uid > :uid", [
    ':timestamp' => $interval,
    ':uid' => 0,
  ])
    ->fetchField();
  $data = [
    'status' => NAGIOS_STATUS_OK,
    'type' => 'perf',
    'text' => $count,
  ];
  return [
    'key' => 'SAU',
    'data' => $data,
  ];
}