Monitoring CiviCRM » History » Version 2
  Jon Goldberg, 06/09/2017 03:03 PM 
  
| 1 | 1 | Jon Goldberg | {{last_updated_at}} by {{last_updated_by}} | 
|---|---|---|---|
| 2 | # Monitoring CiviCRM  | 
||
| 3 | |||
| 4 | ### CiviCRM 4.6 and below  | 
||
| 5 | Install CiviMonitor:  | 
||
| 6 | |||
| 7 | - Log into the website, browse to CiviCRM.  | 
||
| 8 | - Go to **Administer menu > System Settings > Manage  | 
||
| 9 | Extensions**.  | 
||
| 10 | - On Civi sites that have been updated from much older versions,  | 
||
| 11 | this may be **Administer menu > Customize Data and  | 
||
| 12 | Screens > Manage Extensions**.  | 
||
| 13 | - Click on the "Add New" tab.  | 
||
| 14 | - Click "Download" next to "CiviCRM Monitoring for Nagios".  | 
||
| 15 | - Continue with the "All versions" directions.  | 
||
| 16 | |||
| 17 | ### All versions  | 
||
| 18 | |||
| 19 | - **NOTE**: The next two items use `drush` on Drupal. If using  | 
||
| 20 | Wordpress, substitute `wp cv civicrm-sql-query` for  | 
||
| 21 | `drush civicrm-sql-query`.  | 
||
| 22 | - Determine if there's an existing administrative user with an API  | 
||
| 23 | |||
| 24 | 2 | Jon Goldberg | ```bash  | 
| 25 | drush civicrm-sql-query 'SELECT display_name, api_key FROM civicrm_contact WHERE api_key IS NOT NULL;'  | 
||
| 26 | ```  | 
||
| 27 | 1 | Jon Goldberg | - If so, grab that API key. If not, use `pwgen` or similar to generate  | 
| 28 | a random string, then update CiviCRM with it:  | 
||
| 29 | |||
| 30 | 2 | Jon Goldberg | ```bash  | 
| 31 | drush civicrm-sql-query 'UPDATE civicrm_contact SET api_key = "<api key here>" WHERE id = 2;'  | 
||
| 32 | ```  | 
||
| 33 | 1 | Jon Goldberg | - Get the site key:  | 
| 34 | |||
| 35 | 2 | Jon Goldberg | ```bash  | 
| 36 | grep SITE_KEY sites/default/civicrm.settings.php #(Drupal)  | 
||
| 37 | grep SITE_KEY wp-content/plugins/civicrm/civicrm.settings.php #(Wordpress)  | 
||
| 38 | ```  | 
||
| 39 | 1 | Jon Goldberg | |
| 40 | Icinga Configuration  | 
||
| 41 | --------------------  | 
||
| 42 | |||
| 43 | - Log into the Icinga server: `ssh icinga`  | 
||
| 44 | - If necessary, define the new host by making a copy of an existing  | 
||
| 45 | host file in `/etc/icinga2/conf.d/hosts`.  | 
||
| 46 | - Add the lines:  | 
||
| 47 | |||
| 48 | 2 | Jon Goldberg | ```  | 
| 49 | vars.cms = "drupal"  | 
||
| 50 | vars.crm_site_key = "<site key here>"  | 
||
| 51 | vars.crm_api_key = "<api key here>"  | 
||
| 52 | ```  | 
||
| 53 | 1 | Jon Goldberg | - Other valid values for CMS are "wordpress" and "joomla".  | 
| 54 | - TODO: Indicate if SSL is required and how to indicate it.  | 
||
| 55 | - Test your syntax with: `service icinga2 checkconfig`.  | 
||
| 56 | - Restart Icinga: `service icinga2 restart`  |