Insights API

Sometimes it is necessary to access Red Hat Insights via API, for example when a system was deleted before
being un-registered from Red Hat Insights. For this purpose it is useful to have a container, running isolated
from the operating system, that allows users to remove the not longer existing host from cloud.redhat.com.

Install the container tools :

$ sudo dnf install buildah podman skopeo

Sign in to registry.redhat.io :

$ sudo podman login registry.redhat.io

Pull the RHEL 8 UBI image :

$ sudo podman pull registry.redhat.io/ubi8/ubi

Start the insights container :

$ sudo podman run --name insights --privileged -it registry.redhat.io/ubi8/ubi /usr/bin/bash

Install perl-JSON-PP & clean :

# dnf install perl-JSON-PP
# dnf clean all
# rm -r /var/cache/dnf

Get info about registered hosts :

# curl -k --user <username> https://cloud.redhat.com/api/inventory/v1/hosts | json_pp > /home/hosts.json

Check for the 'id' to get deleted :

# cat /home/hosts.json

Delete the non-existing system :

# curl -k --user <username> -X "DELETE" https://cloud.redhat.com/api/inventory/v1/hosts/<id>

Now exit the insights container :

# exit

Want to use the container again ?

$ sudo podman start --attach insights

About Me

I am using Red Hat based IT products - they provide absolute reliability, maximum
security, proper performance and also grant access to a huge amount of software.

I am running the latest editions of CentOS, Fedora, and Red Hat Enterprise Linux
server and workstation operating systems on physical and virtual machines (VM).

My dedicated capabilities and interests are : backup solutions & disaster recovery,
hardware drivers, infrastructure deployment, storage management, virtualization

Disclaimer

The content of the site is monitored continuously. If unintentionally rights of organizations, persons
or things will be violated, I ask for information, so that this deficiency can be corrected immediately.

All Red Hat images, logos and trademarks displayed on this website are the property of Red Hat, Inc.
I assume no liability for external links, the owners of those websites are responsible for the content.