Monitoring CiviCRM » History » Version 7
  Jon Goldberg, 04/30/2019 10:17 PM 
  
| 1 | 1 | Jon Goldberg | {{last_updated_at}} by {{last_updated_by}} | 
|---|---|---|---|
| 2 | # Monitoring CiviCRM  | 
||
| 3 | |||
| 4 | ### All versions  | 
||
| 5 | |||
| 6 | - **NOTE**: The next two items use `drush` on Drupal. If using  | 
||
| 7 | Wordpress, substitute `wp cv civicrm-sql-query` for  | 
||
| 8 | `drush civicrm-sql-query`.  | 
||
| 9 | - Determine if there's an existing administrative user with an API  | 
||
| 10 | |||
| 11 | 2 | Jon Goldberg | ```bash  | 
| 12 | drush civicrm-sql-query 'SELECT display_name, api_key FROM civicrm_contact WHERE api_key IS NOT NULL;'  | 
||
| 13 | ```  | 
||
| 14 | 1 | Jon Goldberg | - If so, grab that API key. If not, use `pwgen` or similar to generate  | 
| 15 | a random string, then update CiviCRM with it:  | 
||
| 16 | |||
| 17 | 2 | Jon Goldberg | ```bash  | 
| 18 | drush civicrm-sql-query 'UPDATE civicrm_contact SET api_key = "<api key here>" WHERE id = 2;'  | 
||
| 19 | ```  | 
||
| 20 | 1 | Jon Goldberg | - Get the site key:  | 
| 21 | |||
| 22 | 2 | Jon Goldberg | ```bash  | 
| 23 | grep SITE_KEY sites/default/civicrm.settings.php #(Drupal)  | 
||
| 24 | grep SITE_KEY wp-content/plugins/civicrm/civicrm.settings.php #(Wordpress)  | 
||
| 25 | ```  | 
||
| 26 | 1 | Jon Goldberg | |
| 27 | Icinga Configuration  | 
||
| 28 | --------------------  | 
||
| 29 | |||
| 30 | - Log into the Icinga server: `ssh icinga`  | 
||
| 31 | - If necessary, define the new host by making a copy of an existing  | 
||
| 32 | host file in `/etc/icinga2/conf.d/hosts`.  | 
||
| 33 | - Add the lines:  | 
||
| 34 | |||
| 35 | ```  | 
||
| 36 | cms = "drupal"  | 
||
| 37 | crm_site_key = "<site key here>"  | 
||
| 38 | crm_api_key = "<api key here>"  | 
||
| 39 | ```  | 
||
| 40 | - Other valid values for CMS are "wordpress" and "joomla".  | 
||
| 41 | 2 | Jon Goldberg | - Test your syntax with: `service icinga2 checkconfig`.  | 
| 42 | 3 | Jon Goldberg | - Restart Icinga: `service icinga2 restart`  | 
| 43 | 5 | Jon Goldberg | |
| 44 | ### Shutting up specific messages from CLI  | 
||
| 45 | 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.  | 
||
| 46 | ```bash  | 
||
| 47 | cv api StatusPreference.create name=checkVersion_upgrade hush_until=2018-10-04 ignore_severity=2  | 
||
| 48 | 6 | Jon Goldberg | cv api StatusPreference.create name=checkVersion_patch hush_until=2018-10-04 ignore_severity=2  | 
| 49 | 5 | Jon Goldberg | ```  | 
| 50 | 7 | Jon Goldberg | |
| 51 | ### Basic auth  | 
||
| 52 | If your site is behind basic auth, add this to the Icinga vhost configuration  | 
||
| 53 | ```  | 
||
| 54 | basic_auth_user = "megaphone"  | 
||
| 55 | basic_auth_password = "megaphone"  | 
||
| 56 | ```  |