Updated over 3 years ago by Jon Goldberg

Monitoring CiviCRM

All versions

  • NOTE: The next two items use drush on Drupal. If using Wordpress, substitute wp cv civicrm-sql-query for drush civicrm-sql-query.
  • Determine if there's an existing administrative user with an API
drush civicrm-sql-query 'SELECT display_name, api_key FROM civicrm_contact WHERE api_key IS NOT NULL;'
  • If so, grab that API key. If not, use pwgen or similar to generate a random string, then update CiviCRM with it:
drush civicrm-sql-query 'UPDATE civicrm_contact SET api_key = "<api key here>" WHERE id = 2;'
  • Get the site key:
grep SITE_KEY sites/default/civicrm.settings.php #(Drupal)
grep SITE_KEY wp-content/plugins/civicrm/civicrm.settings.php #(Wordpress)

Icinga Configuration

  • Log into the Icinga server: ssh icinga
  • If necessary, define the new host by making a copy of an existing host file in /etc/icinga2/conf.d/hosts.
  • Add the lines:
cms = "drupal" 
crm_site_key = "<site key here>"
crm_api_key = "<api key here>"
  • Other valid values for CMS are "wordpress" and "joomla".
  • Test your syntax with: service icinga2 checkconfig.
  • Restart Icinga: service icinga2 restart

Shutting up specific messages from CLI

If you need to quiet a particular message from CiviCRM monitoring, you can use a command like this. Severity level is 2 for notice, 3 for warning, 4 for critical.

cv api StatusPreference.create name=checkVersion_upgrade hush_until=2018-10-04 ignore_severity=2
cv api StatusPreference.create name=checkVersion_patch hush_until=2018-10-04 ignore_severity=2

Basic auth

If your site is behind basic auth, add this to the Icinga vhost configuration

    basic_auth_user = "megaphone"
    basic_auth_password = "megaphone"

Updated by Jon Goldberg over 3 years ago · 7 revisions