What are the function of Candlepin tables?

Solution Verified - Updated

Environment

  • Red Hat Satellite 6

Issue

  • What is a basic summary of the function of some of the candlepin tables?

Resolution

  • In preparation to access this information, its required to connect to the correct database.
# su - postgres # su as the postgres user
$ psql candlepin

Please see the following solution, to find out more information from candlepin tables.
This This content is not included.solution lists a diagram that shows the connection between the different databases.

  • upstream_consumer
    Each time you had import a manifest, it will list the connecting distributor.
    candlepin=# select * from cp_upstream_consumer;

  • cp_import_record
    This is the current history of events for when a manifest is uploaded or deleted. This information will match with the above command but will display timestamps and which users ran the command, as well as the files imported.
    cp_import_record=# select * from cp_import_record;

  • cp_subscription
    Whenever a manifest provides subscriptions, it will update this database that contains the product id, date inserted, quantity, account and contract number.
    select * from cp_subscription;

  • cp_content
    select * from cp_content;
    Upon a manifest being upload, it will also contain links to different repositories, this is one way to check which repository a manifest provides.
    The other being using the manifest troubleshooting commands.

  • cp_event
    select * from cp_event;
    This is every event in relation to subscription, each time you register a host, update a subscription it will get added here.

  • cp_stat_history
    This list will be for the subscription count and it includes both Physical and Virtual. You can use this to double check if a subscription is overly consumed.
    select * from cp_stat_history ;

  • cp_consumer
    This will list the content hosts and hosts that are subscribed to the Satellite server, you can check to see if a host is entitled and when the host was last updated.

select name,releasever  from cp_consumer;
select created,entitlementstatus from cp_consumer where entitlementstatus = 'valid';

You can even use group and count(*) to make adjustments to the command with:

select entitlementstatus, count(*) from cp_consumer group by entitlementstatus;
  • cp_consumer_facts
    This will contain a list of facts of guests that are subscribed to the satellite and list the uuid, socket, hostname and more.
    Below is an example of combining cp_consumer with cp_consumer facts to list only hosts that have the major release version of 7.
    This can be changed to date or any of the column values based on your needs.
(select name from cp_consumer where id IN (select cp_consumer_id from cp_consumer_facts where ((mapkey='dmi.system.version' or mapkey='network.hostname') and element like '7Server%')
  • cp_job
    Candlepin has a list of jobs that run tasks in the background via cron. From here we can check the status of which jobs were recently run.
    It will list the start and end time, so that you can monitor how long a task has taken. For instance a task may have taken longer than usual.
    Some of these tasks that can be seen are
- ActiveEntitlementJob
- ExpiredPoolsJob
- regen_entitlement_cert_of_env
- StatisticHistoryTask
- UnmappedGuestEntitlementCleanerJob
- ExportCleaner
- CleanupGuestIdsCheckInsJob
- JobCleaner
- CleanupCheckInsJob
- ImportRecordJob
- CertificateRevocationListTask
- UnpauseJob
- CancelJobJob
- SweepBarJob

For more KB articles/solutions related to Red Hat Satellite 6.x Candlepin Issues, please refer to the Consolidated Troubleshooting Article for Red Hat Satellite 6.x Candlepin Issues

Diagnostic Steps

                     List of relations
 Schema |             Name              | Type  |   Owner   
--------+-------------------------------+-------+-----------
 public | cp_activation_key             | table | candlepin
 public | cp_activationkey_pool         | table | candlepin
 public | cp_activationkey_product      | table | candlepin
 public | cp_branding                   | table | candlepin
 public | cp_cdn                        | table | candlepin
 public | cp_cdn_certificate            | table | candlepin
 public | cp_cert_serial                | table | candlepin
 public | cp_certificate                | table | candlepin
 public | cp_consumer                   | table | candlepin
 public | cp_consumer_capability        | table | candlepin
 public | cp_consumer_checkin           | table | candlepin
 public | cp_consumer_content_tags      | table | candlepin
 public | cp_consumer_facts             | table | candlepin
 public | cp_consumer_guests            | table | candlepin
 public | cp_consumer_guests_attributes | table | candlepin
 public | cp_consumer_hypervisor        | table | candlepin
 public | cp_consumer_type              | table | candlepin
 public | cp_content                    | table | candlepin
 public | cp_content_modified_products  | table | candlepin
 public | cp_content_override           | table | candlepin
 public | cp_deleted_consumers          | table | candlepin
 public | cp_dist_version               | table | candlepin
 public | cp_dist_version_capability    | table | candlepin
 public | cp_ent_certificate            | table | candlepin
 public | cp_entitlement                | table | candlepin
 public | cp_env_content                | table | candlepin
 public | cp_environment                | table | candlepin
 public | cp_event                      | table | candlepin
 public | cp_export_metadata            | table | candlepin
 public | cp_guest_ids_checkin          | table | candlepin
 public | cp_id_cert                    | table | candlepin
 public | cp_import_record              | table | candlepin
 public | cp_import_upstream_consumer   | table | candlepin
 public | cp_installed_products         | table | candlepin
 public | cp_job                        | table | candlepin
 public | cp_key_pair                   | table | candlepin
 public | cp_owner                      | table | candlepin
 public | cp_permission                 | table | candlepin
 public | cp_pool                       | table | candlepin
 public | cp_pool_attribute             | table | candlepin
 public | cp_pool_branding              | table | candlepin
 public | cp_pool_products              | table | candlepin
 public | cp_pool_source_stack          | table | candlepin
 public | cp_pool_source_sub            | table | candlepin
 public | cp_product                    | table | candlepin
 public | cp_product_attribute          | table | candlepin
 public | cp_product_certificate        | table | candlepin
 public | cp_product_content            | table | candlepin
 public | cp_product_dependent_products | table | candlepin
 public | cp_product_pool_attribute     | table | candlepin
 public | cp_role                       | table | candlepin
 public | cp_role_users                 | table | candlepin
 public | cp_rules                      | table | candlepin
 public | cp_stat_history               | table | candlepin
 public | cp_sub_branding               | table | candlepin
 public | cp_sub_derivedprods           | table | candlepin
 public | cp_subscription               | table | candlepin
 public | cp_subscription_products      | table | candlepin
 public | cp_upstream_consumer          | table | candlepin
 public | cp_user                       | table | candlepin
 public | databasechangelog             | table | candlepin
 public | databasechangeloglock         | table | candlepin
 public | qrtz_blob_triggers            | table | candlepin
 public | qrtz_calendars                | table | candlepin
 public | qrtz_cron_triggers            | table | candlepin
 public | qrtz_fired_triggers           | table | candlepin
 public | qrtz_job_details              | table | candlepin
 public | qrtz_locks                    | table | candlepin
 public | qrtz_paused_trigger_grps      | table | candlepin
 public | qrtz_scheduler_state          | table | candlepin
 public | qrtz_simple_triggers          | table | candlepin
 public | qrtz_simprop_triggers         | table | candlepin
 public | qrtz_triggers                 | table | candlepin
(73 rows)
SBR
Product(s)
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.