{"id":7305,"library":"insights-core","title":"Insights Core","description":"Insights Core is a data collection and analysis framework built for extensibility and rapid development. It allows users to create components that collect and transform raw system data into typed Python objects, which are then used in rules to encapsulate knowledge. The library provides reusable components for various data gathering methods and offers a reliable object model for unstructured and semi-structured data. The project maintains an active release cadence, with weekly revisions and minor version bumps approximately every 25 revisions.","status":"active","version":"3.7.5","language":"en","source_language":"en","source_url":"https://github.com/redhatinsights/insights-core","tags":["data collection","analysis","framework","redhat","diagnostics"],"install":[{"cmd":"pip install insights-core","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"symbol":"load_default_plugins","correct":"from insights import load_default_plugins, run"},{"symbol":"run","correct":"from insights import load_default_plugins, run"},{"note":"Commonly aliased as 'rpm' for convenience.","symbol":"installed_rpms","correct":"from insights.parsers import installed_rpms as rpm"},{"note":"Used for dependency resolution and component registration.","symbol":"dr","correct":"from insights.core import dr"}],"quickstart":{"code":"from insights import load_default_plugins, run\nfrom insights.parsers import installed_rpms as rpm\n\n# Load all default insights components (parsers, combiners, rules)\nload_default_plugins()\n\n# Simulate running insights on a system and collect installed RPMs\n# In a real scenario, `run()` would process collected data from a host or archive.\n# For this example, we'll access the parser directly, typically data comes via contexts.\n# To get actual data, you would normally specify a context, e.g., HostContext\n\n# Example of getting parsed data (conceptual, run() works with a Broker context)\n# Normally, the run() call would fill the broker with data from all active components.\n# For a local execution, you might run `insights-run` CLI or use specific contexts.\n# Let's illustrate with a simple check using a known parser output.\n# In a programmatic usage, `run()` is typically invoked on a Broker.\n# This example is adapted from the PyPI description.\n\n# The 'run' function typically takes a list of components or a Broker instance.\n# For a simple local check without a full host context setup:\n# If you were running against a system, 'run()' would implicitly collect data.\n# For a quick local check on a parser, you'd feed it content.\n# The example from PyPI is more illustrative of using the *results* from a run.\n\n# This is a conceptual example based on docs, actual `run()` requires a context or data feed.\n# A direct `run()` call will gather data based on active contexts (e.g., HostContext by default).\nresults = run(rpm.Installed)\n\n# Accessing the parsed RPM data from the results\nif rpm.Installed in results:\n    installed_rpms_data = results[rpm.Installed]\n    print(f\"Newest bash version: {installed_rpms_data.newest('bash')}\")\nelse:\n    print(\"Installed RPMs data not found in results.\")\n\n# Note: To run this against actual system data, `insights-core` typically\n# works with data collected by `insights-client` or processed via specific contexts.\n# A simple `run()` without explicit context uses the default HostContext if available.\n","lang":"python","description":"Initializes insights-core by loading default plugins (parsers, combiners, rules) and then demonstrates how to execute components to gather and analyze data, such as finding the newest version of a package. In a full system, `run()` would operate within a specific context (e.g., a live host or an archive) to collect and process data."},"warnings":[{"fix":"Consult the official documentation's 'Feature Deprecation' section before upgrading to identify and migrate away from deprecated components.","message":"Specific functions, class methods, and entire classes within `insights-core` are subject to deprecation. Refer to the 'Feature Deprecation' section in the official documentation for an 'insights-core release timeline' to see which features will be removed in upcoming minor versions.","severity":"deprecated","affected_versions":"All versions (future removals from 3.x to 3.x+1)"},{"fix":"If `insights-client --version` shows an outdated core or updates fail, manually remove the ETag files: `/etc/insights-client/.insights-core.etag` and `/etc/insights-client/.insights-core.gpg-sig.etag` (or similar paths) before re-running `insights-client`.","message":"When using `insights-client` to update `insights-core`, the client might not download the latest core egg due to persistent ETags, leading to an outdated core version despite successful client execution.","severity":"gotcha","affected_versions":"All versions integrated with `insights-client`"},{"fix":"This often points to an issue with the Satellite server configuration or a proxy. Check Satellite logs for more details. If using Insights On-Prem, ensure the `insights-client` is correctly registered or unregister and re-register using `insights-client --unregister`.","message":"Users often encounter '500: Internal Server Error' when `insights-client` attempts to fetch the `insights-core.egg` from a Red Hat Satellite server, particularly after Satellite upgrades. This can prevent the core from updating.","severity":"gotcha","affected_versions":"All versions integrated with `insights-client` in Satellite environments (especially Satellite 6.9.x and 6.17)"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Inspect the Satellite server logs for specific errors. Verify network connectivity from the client to the Satellite server. If applicable, try unregistering and re-registering the `insights-client` using `insights-client --unregister`.","cause":"The `insights-client` failed to download the `insights-core.egg` from the configured URL (often a Red Hat Satellite server) due to a server-side or network error.","error":"Unable to fetch egg url ... 500: Internal Server Error. Defaulting to /release Machine-id found"},{"fix":"Delete the ETag cache files, typically located at `/etc/insights-client/.insights-core.etag` and `/etc/insights-client/.insights-core.gpg-sig.etag`, then re-run `insights-client`.","cause":"The `insights-client` might be caching the ETag for the `insights-core.egg` file, leading it to believe the local version is still current, thus not downloading a newer available version.","error":"insights-client --version shows an old Core version after client execution."},{"fix":"Ensure `insights-core` is installed in the active Python environment (`pip install insights-core`). If using a virtual environment, make sure it's activated before running the script. Verify the Python executable path.","cause":"The `insights-core` package is either not installed, or the Python environment where the script is being run does not have access to the installed package. This can happen in isolated virtual environments.","error":"ImportError: No module named 'insights.core.dr' (or similar for other core modules)"}]}