Bug 1376480 - Add pacemaker alerts support to web UI
Summary: Add pacemaker alerts support to web UI
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: pcs
Version: 6.8
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Ondrej Mular
QA Contact: cluster-qe@redhat.com
URL:
Whiteboard:
Depends On: 1315371
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-15 14:19 UTC by Tomas Jelinek
Modified: 2017-03-21 11:04 UTC (History)
8 users (show)

Fixed In Version: pcs-0.9.155-1.el6
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1376478
Environment:
Last Closed: 2017-03-21 11:04:23 UTC
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2017:0707 normal SHIPPED_LIVE pcs bug fix update 2017-03-21 12:40:33 UTC

Description Tomas Jelinek 2016-09-15 14:19:45 UTC
+++ This bug was initially created as a clone of Bug #1376478 +++

Pacemaker alerts support has been added to CLI by bz1315371. We need to add web UI support as well.


If we want to manage pacemaker alerts in 6.9 cluster from 7.4 web UI, we need to have at least backend support for it in 6.9.

Comment 3 Ondrej Mular 2016-11-02 13:14:30 UTC
Upstream patches:
https://github.com/ClusterLabs/pcs/commit/1a0ffdcfde4be32a785f227740bc8515ab30
https://github.com/ClusterLabs/pcs/commit/ee68ae027e6dcfdc6db8b1946dac389011f4

new pcsd API endpoints (see below for usage):
CREATE ALERT:
Request /remote/create_alert
  Parameters:
    Required: path
    Optional: alert_id, description, meta_attr[], instance_attr[]
UPDATE ALERT:
Request /remote/update_alert
  Parameters:
    Required: alert_id
    Optional: path, description, meta_attr[], instance_attr[]
CREATE RECIPIENT:
Request /remote/create_recipient
  Parameters:
    Required: alert_id, value
    Optional: recipient_id, description, meta_attr[], instance_attr[]
UPDATE RECIPIENT:
Request: /remote/update_recipient
  Parameters:
    Required: recipient_id
    Optional: value, description, meta_attr[], instance_attr[]
REMOVE ALERTS AND RECIPIENTS:
Request: /remote/remove_alerts_and_recipients
  Parameters: alert_list[], recipient_list[]

TEST:
> 2 node cluster
> make auth token for localhost so we can use localhost for test
[root@rhel6-node1 ~]# pcs cluster auth localhost -uhacluster
Password: 
localhost: Authorized
[root@rhel6-node1 ~]# export pcsd_token=$(pcs cluster token localhost)

> no alerts configured before test
[root@rhel6-node1 ~]# pcs alert
Alerts:
 No alerts defined

> create some alerts using pcsd
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/create_alert \
    -d path=/some/path \
    -d "description=this is alert description" \
    -d alert_id=test_alert \
    -d meta_attr[meta_attr1]=value1 \
    -d meta_attr[another_meta_attr]=its_value \
    -d instance_attr[attr1]=val1 \
    -d instance_attr[attribute1]=value1
Alert created[root@rhel6-node1 ~]#
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/create_alert \
    -d path=/path
Alert created[root@rhel6-node1 ~]# 
[root@rhel6-node1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/some/path)
  Description: this is alert description
  Options: attr1=val1 attribute1=value1
  Meta options: another_meta_attr=its_value meta_attr1=value1
 Alert: alert (path=/path)

> alert update
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/update_alert \
    -d alert_id=test_alert \
    -d path=/new/path \
    -d "description=new description" \
    -d meta_attr[meta_attr1]= \
    -d meta_attr[another_meta_attr]=new_value \
    -d meta_attr[new_meta]=value \
    -d instance_attr[attr1]= \
    -d instance_attr[attribute1]=value2 \
    -d instance_attr[new_attr]=new_val
Alert updated[root@rhel6-node1 ~]# 
[root@rhel6-node1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
 Alert: alert (path=/path)

> adding recipient
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/create_recipient \
    -d value=test_val \
    -d alert_id=alert \
    -d recipient_id=test_recipient \
    -d "description=recipient description" \
    -d meta_attr[rec_meta_attr1]=val1 \
    -d meta_attr[rec_meta_attr2]=val2 \
    -d instance_attr[rec_inst_attr1]=value1 \
    -d instance_attr[rec_inst_attr2]=value2
Recipient created[root@rhel6-node1 ~]# 
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/create_recipient \
    -d value=recipient_value \
    -d alert_id=test_alert
Recipient created[root@rhel6-node1 ~]#
[root@rhel6-node1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
  Recipients:
   Recipient: test_alert-recipient (value=recipient_value)
 Alert: alert (path=/path)
  Recipients:
   Recipient: test_recipient (value=test_val)
    Description: recipient description
    Options: rec_inst_attr1=value1 rec_inst_attr2=value2
    Meta options: rec_meta_attr1=val1 rec_meta_attr2=val2

> update recipient
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/update_recipient \
    -d recipient_id=test_recipient \
    -d value=new_val \
    -d "description=new recipient description" \
    -d meta_attr[rec_meta_attr1]= \
    -d meta_attr[rec_meta_attr2]=new_val2 \
    -d meta_attr[rec_meta_attr3]=val3 \
    -d instance_attr[rec_inst_attr1]= \
    -d instance_attr[rec_inst_attr2]=new_value2 \
    -d instance_attr[rec_inst_attr3]=value3
Recipient updated[root@rhel6-node1 ~]# 
[root@rhel6-node1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
  Recipients:
   Recipient: test_alert-recipient (value=recipient_value)
 Alert: alert (path=/path)
  Recipients:
   Recipient: test_recipient (value=new_val)
    Description: new recipient description
    Options: rec_inst_attr2=new_value2 rec_inst_attr3=value3
    Meta options: rec_meta_attr2=new_val2 rec_meta_attr3=val3

> create some more alerts and recipients
[root@rhel6-node1 ~]# pcs alert create path=path1
[root@rhel6-node1 ~]# pcs alert create path=path2
[root@rhel6-node1 ~]# pcs alert recipient add alert-1 value=val1
[root@rhel6-node1 ~]# pcs alert recipient add alert-1 value=val2
[root@rhel6-node1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
  Recipients:
   Recipient: test_alert-recipient (value=recipient_value)
 Alert: alert (path=/path)
  Recipients:
   Recipient: test_recipient (value=new_val)
    Description: new recipient description
    Options: rec_inst_attr2=new_value2 rec_inst_attr3=value3
    Meta options: rec_meta_attr2=new_val2 rec_meta_attr3=val3
 Alert: alert-1 (path=path1)
  Recipients:
   Recipient: alert-1-recipient (value=val1)
   Recipient: alert-1-recipient-1 (value=val2)
 Alert: alert-2 (path=path2)

> remove multiple alerts and recipients
[root@rhel6-node1 ~]# curl -b "token=$pcsd_token" -k \
  https://localhost:2224/remote/remove_alerts_and_recipients \
    -d recipient_list[]=alert-1-recipient-1 \
    -d recipient_list[]=test_recipient \
    -d alert_list[]=alert-2 \
    -d alert_list[]=test_alert
All removed[root@rhel6-node1 ~]# 
[root@rhel6-node1 ~]# pcs alert
Alerts:
 Alert: alert (path=/path)
 Alert: alert-1 (path=path1)
  Recipients:
   Recipient: alert-1-recipient (value=val1)

Comment 4 Ivan Devat 2016-11-07 15:42:38 UTC
Before Fix:

Alerts not supported.


After Fix:

[root@vm-rhel67-1 ~]# rpm -q pcs
pcs-0.9.155-1.el6.x86_64

> make auth token for localhost so we can use localhost for test

[root@vm-rhel67-1 ~]# pcs cluster auth localhost -uhacluster
Password:
localhost: Authorized
[root@vm-rhel67-1 ~]# export pcsd_token=$(pcs cluster token localhost)

> no alerts configured before test

[root@vm-rhel67-1 ~]# pcs alert
Alerts:
 No alerts defined

> create some alerts using pcsd

[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/create_alert \
      -d path=/some/path \
      -d "description=this is alert description" \
      -d alert_id=test_alert \
      -d meta_attr[meta_attr1]=value1 \
      -d meta_attr[another_meta_attr]=its_value \
      -d instance_attr[attr1]=val1 \
      -d instance_attr[attribute1]=value1
Alert created[root@vm-rhel67-1 ~]#
[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/create_alert \
      -d path=/path
Alert created[root@vm-rhel67-1 ~]#
[root@vm-rhel67-1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/some/path)
  Description: this is alert description
  Options: attr1=val1 attribute1=value1
  Meta options: another_meta_attr=its_value meta_attr1=value1
 Alert: alert (path=/path)

> alert update

[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/update_alert \
      -d alert_id=test_alert \
      -d path=/new/path \
      -d "description=new description" \
      -d meta_attr[meta_attr1]= \
      -d meta_attr[another_meta_attr]=new_value \
      -d meta_attr[new_meta]=value \
      -d instance_attr[attr1]= \
      -d instance_attr[attribute1]=value2 \
      -d instance_attr[new_attr]=new_val
Alert updated[root@vm-rhel67-1 ~]#
root@vm-rhel67-1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
 Alert: alert (path=/path)

> adding recipient

[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/create_recipient \
      -d value=test_val \
      -d alert_id=alert \
      -d recipient_id=test_recipient \
      -d "description=recipient description" \
      -d meta_attr[rec_meta_attr1]=val1 \
      -d meta_attr[rec_meta_attr2]=val2 \
      -d instance_attr[rec_inst_attr1]=value1 \
      -d instance_attr[rec_inst_attr2]=value2
Recipient created[root@vm-rhel67-1 ~]#
[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/create_recipient \
      -d value=recipient_value \
      -d alert_id=test_alert
Recipient created[root@vm-rhel67-1 ~]#
[root@vm-rhel67-1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
  Recipients:
   Recipient: test_alert-recipient (value=recipient_value)
 Alert: alert (path=/path)
  Recipients:
   Recipient: test_recipient (value=test_val)
    Description: recipient description
    Options: rec_inst_attr1=value1 rec_inst_attr2=value2
    Meta options: rec_meta_attr1=val1 rec_meta_attr2=val2

> update recipient

[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/update_recipient \
      -d recipient_id=test_recipient \
      -d value=new_val \
      -d "description=new recipient description" \
      -d meta_attr[rec_meta_attr1]= \
      -d meta_attr[rec_meta_attr2]=new_val2 \
      -d meta_attr[rec_meta_attr3]=val3 \
      -d instance_attr[rec_inst_attr1]= \
      -d instance_attr[rec_inst_attr2]=new_value2 \
      -d instance_attr[rec_inst_attr3]=value3
Recipient updated[root@vm-rhel67-1 ~]#
[root@vm-rhel67-1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
  Recipients:
   Recipient: test_alert-recipient (value=recipient_value)
 Alert: alert (path=/path)
  Recipients:
   Recipient: test_recipient (value=new_val)
    Description: new recipient description
    Options: rec_inst_attr2=new_value2 rec_inst_attr3=value3
    Meta options: rec_meta_attr2=new_val2 rec_meta_attr3=val3

> create some more alerts and recipients

[root@vm-rhel67-1 ~]# pcs alert create path=path1
[root@vm-rhel67-1 ~]# pcs alert create path=path2
[root@vm-rhel67-1 ~]# pcs alert recipient add alert-1 value=val1
[root@vm-rhel67-1 ~]# pcs alert recipient add alert-1 value=val2
[root@vm-rhel67-1 ~]# pcs alert
Alerts:
 Alert: test_alert (path=/new/path)
  Description: new description
  Options: attribute1=value2 new_attr=new_val
  Meta options: another_meta_attr=new_value new_meta=value
  Recipients:
   Recipient: test_alert-recipient (value=recipient_value)
 Alert: alert (path=/path)
  Recipients:
   Recipient: test_recipient (value=new_val)
    Description: new recipient description
    Options: rec_inst_attr2=new_value2 rec_inst_attr3=value3
    Meta options: rec_meta_attr2=new_val2 rec_meta_attr3=val3
 Alert: alert-1 (path=path1)
  Recipients:
   Recipient: alert-1-recipient (value=val1)
   Recipient: alert-1-recipient-1 (value=val2)
 Alert: alert-2 (path=path2)

> remove multiple alerts and recipients

[root@vm-rhel67-1 ~]# curl -b "token=$pcsd_token" -k \
    https://localhost:2224/remote/remove_alerts_and_recipients \
      -d recipient_list[]=alert-1-recipient-1 \
      -d recipient_list[]=test_recipient \
      -d alert_list[]=alert-2 \
      -d alert_list[]=test_alert
All removed[root@vm-rhel67-1 ~]#
[root@vm-rhel67-1 ~]# pcs alert
Alerts:
 Alert: alert (path=/path)
 Alert: alert-1 (path=path1)
  Recipients:
   Recipient: alert-1-recipient (value=val1)

Comment 8 errata-xmlrpc 2017-03-21 11:04:23 UTC
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, 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://rhn.redhat.com/errata/RHBA-2017-0707.html


Note You need to log in before you can comment on or make changes to this bug.