Bug 2185803
Summary: | RFE: Allow sending events to AAP using PMIE | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 9 | Reporter: | Marko Myllynen <myllynen> |
Component: | pcp | Assignee: | Nathan Scott <nathans> |
Status: | CLOSED ERRATA | QA Contact: | Jan Kurik <jkurik> |
Severity: | low | Docs Contact: | Jacob Taylor Valdez <jvaldez> |
Priority: | medium | ||
Version: | 9.1 | CC: | briasmit, egolov, gfialova, jkurik, jvaldez, lkuprova, nathans, rmeggins, scox |
Target Milestone: | rc | Keywords: | FutureFeature, Triaged |
Target Release: | 9.3 | ||
Hardware: | All | ||
OS: | All | ||
Whiteboard: | |||
Fixed In Version: | pcp-6.0.4-1.el9 | Doc Type: | Enhancement |
Doc Text: |
.PCP's `pmie` utility now supports generating webhook events
The Performance Metrics Inference Engine (`pmie`) utility from Performance Co-Pilot (PCP) now supports generating webhook events. With this update, configured `pmie` rules generate events in a format consumable by Event-Driven Ansible (EDA). As a result, EDA can respond to PCP rules.
To enable this feature, configure all local `pmie` rules to send to a webhook at a given endpoint (URL):
----
# pmieconf modify global webhook_endpoint https://localhost:443/<endpoint>
# pmieconf modify global webhook_action yes
----
|
Story Points: | --- |
Clone Of: | Environment: | ||
Last Closed: | 2023-11-07 08:30:40 UTC | Type: | Enhancement |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Marko Myllynen
2023-04-11 09:26:13 UTC
Neat - thanks for the pointers Marko, I went through the online lab and think this is a great idea. My limited understanding is that we want a 'source' for PCP pmie events and this would (possibly?) live here: https://github.com/ansible/event-driven-ansible/tree/main/plugins/event_source We'd need to define a mechanism whereby pmie could run something locally when it evaluates events and send notification through to the event source handler, over some transport/IPC mechanism, most likely written in python based on the above repo contents. We could use the existing 'shell' action for that or we may be able to make life easier for this code by having a new pmie action that generates detailed JSON content (e.g. containing the pmieconf rule names, which are not currently made available). That action could do a http POST perhaps .... anyway, just mulling things over here. It'd be very good if this tied in neatly with the existing rules we have that are being consumed by Insights rather than an entire new set of rules to manage. It'd be good to find experts from the Ansible EDA team to work with to make this happen - if you know anyone I should talk to please let me know. Hi Nathan, I'm glad this sounds good to you. My understanding is also far from complete but I was hoping that ideally we should be able to utilize the existing webhook event source somehow. This would mean that only PCP-side changes would be needed if that'd be possible. And as you say, reusing existing rules would make most sense at least in the beginning, no need to redo anything there, just create hopefully a small Python script to act as an alternative way to emit events. Perhaps allowing the user to define a set of variables and the target on the PMIE side which then get passed over with the event. Perhaps this pending blog post (in raw format so a bit hard to read) and references it contains might be helpful, it describes step-by-step how the Foreman/Satellite team setup testing environment for similar kind of development work. In essence, you won't need a full-blown AAP environment to mimic the server side webhook setup and that allows concentrating on the required local changes: https://github.com/theforeman/theforeman.org/pull/2072/files If we could achieve this in somewhat similar fashion then the Python script should be fairly straightforward and the most important part would be to define the "interface" on the PMIE side, or what do you think? Thanks. Hey all, Aha - the webhook event source is news to me, thanks - yes, that should work really well and integrate nicely with existing pmie setup. Very cool. I think some new code in pmie to ensure cleanly formatted JSON events can be generated, some pmieconf support for that, and we'd be pretty much there. If I work on the PCP side of things, is there anyone who can help me with integration testing? (i.e. someone with a working Ansible EDA setup and a webhook endpoint we could point this at?) Thanks! The Foreman/Satellite EDA integration blog post has now been published: https://theforeman.org/2023/04/integrating-foreman-with-event-driven-ansible.html I've opened an upstream PCP pull request (#1756) with a prototype pmie implementation; light testing only so far but looks promising (using the webhook mechanism described in the Foreman blog post). commit e809fee92ba1c0913a8f9393fc161de6955fb1ac Author: Nathan Scott <nathans> Date: Mon Apr 17 17:05:57 2023 +1000 pmieconf: add support for a webhook action to pmieconf Adds support for sending JSON formatted HTTP messages to a webhook endpoint when a pmie predicate triggers. This can be used to augment (or replace) existing pmieconf actions, and is based on the existing pmie_email mechanisms. Quick 2-step primer for primary pmieconf-controlled pmies: # pmieconf modify global webhook_endpoint https://localhost:443/endpoint # pmieconf modify global webhook_action yes Resolves Red Hat BZ #2185803 Great work! I could try to do some light testing as well in a week or so as well, I'll let you know. Thanks! Thanks Marko. I'm planning a full recipe/writeup later this week that should assist with wider testing, hopefully I can turn this into a blog post to. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory (pcp bug fix and enhancement update), and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2023:6406 |