<div dir="ltr">Yes, I had precreated the script file with the required permission. <div><div><br></div><div>[root@<b>node1</b> alerts]# ls -l /usr/share/pacemaker/alert_file.sh</div><div>-rwxr-xr-x. 1 root root 4140 Aug 14 01:51 /usr/share/pacemaker/alert_file.sh</div></div><div><div><div> [root@<b>node2</b> alerts]# ls -l /usr/share/pacemaker/alert_file.sh</div><div>-rwxr-xr-x. 1 root root 4139 Aug 14 01:51 /usr/share/pacemaker/alert_file.sh</div></div><div>[root@<b>node3</b> alerts]# ls -l /usr/share/pacemaker/alert_file.sh</div><div>-rwxr-xr-x. 1 root root 4139 Aug 14 01:51 /usr/share/pacemaker/alert_file.sh</div></div><div><br></div><div>Later I observed that user "hacluster" is not able to create the log file under <span style="font-size:12.8px">/usr/share/pacemaker/</span><wbr style="font-size:12.8px"><span style="font-size:12.8px">alert_file.log.</span></div><div>I am sorry, I should have observed this in the log before posting the query. Then I gave the path as /tmp/alert_file.log, it is able to create now.</div><div><div>Thanks for pointing it out.</div></div><div><br></div><div>I have one more clarification,</div><div><br></div><div>if the resource is running in node2,</div><div>[root@node2 tmp]# pcs resource<br></div><div><div> TRR    (ocf::heartbeat:TimingRedundancyRA):    Started node2</div></div><div><br></div><div>And I executed the below command to make it standby.</div><div>[root@node2 tmp] # pcs node standby node2</div><div><br></div><div>Resource shifted to node3, because of higher location constraint.</div><div><div><div>[root@node2 tmp]# pcs resource</div><div> TRR    (ocf::heartbeat:TimingRedundancyRA):    Started node3.</div></div></div><div><br></div><div><br></div><div>I got the log file created under node2(resource stopped) and node3(resource started). </div><div><br></div><div>Node1 was not notified about the resource shift, I mean no log file was created there.</div><div>Its because alerts are designed to notify the external agents about the cluster events. Its not for internal notifications.</div><div><br></div><div>Is my understanding correct ?</div><div> </div><div>Regards,<br></div><div>Sriram.</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Aug 14, 2017 at 5:42 PM, Klaus Wenninger <span dir="ltr"><<a href="mailto:kwenning@redhat.com" target="_blank">kwenning@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF"><div><div class="h5">
    <div class="m_-4802990479422366187moz-cite-prefix">On 08/14/2017 12:32 PM, Sriram wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">Hi Ken,
        <div><br>
        </div>
        <div>I used the alerts as well, seems to be not working.</div>
        <div><br>
        </div>
        <div>Please check the below configuration</div>
        <div>
          <div>[root@node1 alerts]# pcs config show</div>
          <div>Cluster Name:</div>
          <div>Corosync Nodes:</div>
          <div>Pacemaker Nodes:</div>
          <div> node1 node2 node3</div>
          <div><br>
          </div>
          <div>Resources:</div>
          <div> Resource: TRR (class=ocf provider=heartbeat
            type=TimingRedundancyRA)</div>
          <div>  Operations: start interval=0s timeout=60s
            (TRR-start-interval-0s)</div>
          <div>              stop interval=0s timeout=20s
            (TRR-stop-interval-0s)</div>
          <div>              monitor interval=10 timeout=20
            (TRR-monitor-interval-10)</div>
          <div><br>
          </div>
          <div>Stonith Devices:</div>
          <div>Fencing Levels:</div>
          <div><br>
          </div>
          <div>Location Constraints:</div>
          <div>  Resource: TRR</div>
          <div>    Enabled on: node1 (score:100)
            (id:location-TRR-node1-100)</div>
          <div>    Enabled on: node2 (score:200)
            (id:location-TRR-node2-200)</div>
          <div>    Enabled on: node3 (score:300)
            (id:location-TRR-node3-300)</div>
          <div>Ordering Constraints:</div>
          <div>Colocation Constraints:</div>
          <div>Ticket Constraints:</div>
          <div><br>
          </div>
          <div>Alerts:</div>
          <div> Alert: alert_file
            (path=/usr/share/pacemaker/<wbr>alert_file.sh)</div>
          <div>  Options: debug_exec_order=false</div>
          <div>  Meta options: timeout=15s</div>
          <div>  Recipients:</div>
          <div>   Recipient: recipient_alert_file_id
            (value=/usr/share/pacemaker/<wbr>alert_file.log)</div>
        </div>
      </div>
    </blockquote>
    <br></div></div>
    Did you pre-create the file with proper rights? Be aware that the
    alert-agent<br>
    is called as user hacluster.<span class=""><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div>
          <div><br>
          </div>
          <div>Resources Defaults:</div>
          <div> resource-stickiness: INFINITY</div>
          <div>Operations Defaults:</div>
          <div> No defaults set</div>
          <div><br>
          </div>
          <div>Cluster Properties:</div>
          <div> cluster-infrastructure: corosync</div>
          <div> dc-version: 1.1.15-11.el7_3.4-e174ec8</div>
          <div> default-action-timeout: 240</div>
          <div> have-watchdog: false</div>
          <div> no-quorum-policy: ignore</div>
          <div> placement-strategy: balanced</div>
          <div> stonith-enabled: false</div>
          <div> symmetric-cluster: false</div>
          <div><br>
          </div>
          <div>Quorum:</div>
          <div>  Options:</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>/usr/share/pacemaker/alert_<wbr>file.sh does not get called
          whenever I trigger a scenario for failover.<br>
        </div>
        <div>Please let me know if I m missing anything. <br>
        </div>
      </div>
    </blockquote>
    <br></span>
    Do you get any logs - like for startup of resources - or nothing at
    all?<br>
    <br>
    Regards,<br>
    Klaus<div><div class="h5"><br>
    <br>
    <blockquote type="cite">
      <div dir="ltr">
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra"><br>
        </div>
        <div class="gmail_extra">Regards,</div>
        <div class="gmail_extra">Sriram.</div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On Tue, Aug 8, 2017 at 8:29 PM, Ken
            Gaillot <span dir="ltr"><<a href="mailto:kgaillot@redhat.com" target="_blank">kgaillot@redhat.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
              <div class="m_-4802990479422366187gmail-HOEnZb">
                <div class="m_-4802990479422366187gmail-h5">On Tue, 2017-08-08 at 17:40 +0530,
                  Sriram wrote:<br>
                  > Hi Ulrich,<br>
                  ><br>
                  ><br>
                  > Please see inline.<br>
                  ><br>
                  > On Tue, Aug 8, 2017 at 2:01 PM, Ulrich Windl<br>
                  > <<a href="mailto:Ulrich.Windl@rz.uni-regensburg.de" target="_blank">Ulrich.Windl@rz.uni-regensbur<wbr>g.de</a>>
                  wrote:<br>
                  >         >>> Sriram <<a href="mailto:sriram.ec@gmail.com" target="_blank">sriram.ec@gmail.com</a>>
                  schrieb am <a href="tel:08.08.2017" value="+498082017" target="_blank">08.08.2017</a>
                  um<br>
                  >         09:30 in Nachricht<br>
                  >         <CAMvdjurcQc6t=ZfGr=cRL25Xq0J<wbr>e9h9F_TvZXyxVAn3n<br>
                  >         +<a href="mailto:Dvcgw@mail.gmail.com" target="_blank">Dvcgw@mail.gmail.com</a>>:<br>
                  >         > Hi Ken & Jan,<br>
                  >         ><br>
                  >         > In the cluster we have, there is
                  only one resource running.<br>
                  >         Its a OPT-IN<br>
                  >         > cluster with resource-stickiness set
                  to INFINITY.<br>
                  >         ><br>
                  >         > Just to clarify my question, lets
                  take a scenario where<br>
                  >         there are four<br>
                  >         > nodes N1, N2, N3, N4<br>
                  >         > a. N1 comes up first, starts the
                  cluster.<br>
                  ><br>
                  >         The cluster will start once it has a
                  quorum.<br>
                  ><br>
                  >         > b. N1 Checks that there is no
                  resource running, so it will<br>
                  >         add the<br>
                  >         > resource(R) with the some location
                  constraint(lets say score<br>
                  >         100)<br>
                  >         > c. So Resource(R) runs in N1 now.<br>
                  >         > d. N2 comes up next, checks that
                  resource(R) is already<br>
                  >         running in N1, so<br>
                  >         > it will update the location
                  constraint(lets say score 200)<br>
                  >         > e. N3 comes up next, checks that
                  resource(R) is already<br>
                  >         running in N1, so<br>
                  >         > it will update the location
                  constraint(lets say score 300)<br>
                  ><br>
                  >         See my remark on quorum above.<br>
                  ><br>
                  > Yes you are right, I forgot to mention it.<br>
                  ><br>
                  ><br>
                  >         > f.  N4 comes up next, checks that
                  resource(R) is already<br>
                  >         running in N1, so<br>
                  >         > it will update the location
                  constraint(lets say score 400)<br>
                  >         > g. For the some reason, if N1 goes
                  down, resource(R) shifts<br>
                  >         to N4(as its<br>
                  >         > score is higher than anyone).<br>
                  >         ><br>
                  >         > In this case is it possible to
                  notify the nodes N2, N3 that<br>
                  >         newly elected<br>
                  >         > active node is N4 ?<br>
                  ><br>
                  >         What type of notification, and what would
                  the node do with it?<br>
                  >         Any node in the cluster always has up to
                  date configuration<br>
                  >         information. So it knows the status of
                  the other nodes also.<br>
                  ><br>
                  ><br>
                  > I agree that the node always has upto date
                  configuration information,<br>
                  > but an application or a thread needs to poll for
                  that information. Is<br>
                  > there any way, where the notifications are
                  received through some<br>
                  > action function in RA. ?<br>
                  <br>
                </div>
              </div>
              Ah, I misunderstood your situation, I thought you had a
              cloned resource.<br>
              <br>
              For that, the alerts feature (available in Pacemaker
              1.1.15 and later)<br>
              might be useful:<br>
              <br>
              <a href="http://clusterlabs.org/doc/en-US/Pacemaker/1.1-pcs/html-single/Pacemaker_Explained/index.html#idm139900098676896" rel="noreferrer" target="_blank">http://clusterlabs.org/doc/en-<wbr>US/Pacemaker/1.1-pcs/html-sing<wbr>le/Pacemaker_Explained/index.<wbr>html#idm139900098676896</a><br>
              <div class="m_-4802990479422366187gmail-HOEnZb">
                <div class="m_-4802990479422366187gmail-h5"><br>
                  <br>
                  ><br>
                  ><br>
                  > Regards,<br>
                  > Sriram.<br>
                  ><br>
                  >         ><br>
                  >         > I went through clone notifications
                  and master-slave, Iooks<br>
                  >         like it either<br>
                  >         > requires identical
                  resources(Anonymous) or Unique or<br>
                  >         Stateful resources to<br>
                  >         > be running<br>
                  >         > in all the nodes of the cluster,
                  where as in our case there<br>
                  >         is only<br>
                  >         > resource running in the whole
                  cluster.<br>
                  ><br>
                  >         Maybe the main reason for not having
                  notifications is that if<br>
                  >         a node fails hard, it won't be able to
                  send out much status<br>
                  >         information to the other nodes.<br>
                  ><br>
                  >         Regards,<br>
                  >         Ulrich<br>
                  ><br>
                  >         ><br>
                  >         > Regards,<br>
                  >         > Sriram.<br>
                  >         ><br>
                  >         ><br>
                  >         ><br>
                  >         ><br>
                  >         > On Mon, Aug 7, 2017 at 11:28 AM,
                  Sriram<br>
                  >         <<a href="mailto:sriram.ec@gmail.com" target="_blank">sriram.ec@gmail.com</a>>
                  wrote:<br>
                  >         ><br>
                  >         >><br>
                  >         >> Thanks Ken, Jan. Will look into
                  the clone notifications.<br>
                  >         >><br>
                  >         >> Regards,<br>
                  >         >> Sriram.<br>
                  >         >><br>
                  >         >> On Sat, Aug 5, 2017 at 1:25 AM,
                  Ken Gaillot<br>
                  >         <<a href="mailto:kgaillot@redhat.com" target="_blank">kgaillot@redhat.com</a>>
                  wrote:<br>
                  >         >><br>
                  >         >>> On Thu, 2017-08-03 at 12:31
                  +0530, Sriram wrote:<br>
                  >         >>> ><br>
                  >         >>> > Hi Team,<br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> > We have a four node
                  cluster (1 active : 3 standby) in<br>
                  >         our lab for a<br>
                  >         >>> > particular service. If
                  the active node goes down, one of<br>
                  >         the three<br>
                  >         >>> > standby node  becomes
                  active. Now there will be (1<br>
                  >         active :  2<br>
                  >         >>> > standby : 1 offline).<br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> > Is there any way where
                  this newly elected node sends<br>
                  >         notification to<br>
                  >         >>> > the remaining 2 standby
                  nodes about its new status ?<br>
                  >         >>><br>
                  >         >>> Hi Sriram,<br>
                  >         >>><br>
                  >         >>> This depends on how your
                  service is configured in the<br>
                  >         cluster.<br>
                  >         >>><br>
                  >         >>> If you have a clone or
                  master/slave resource, then clone<br>
                  >         notifications<br>
                  >         >>> is probably what you want
                  (not alerts, which is the path<br>
                  >         you were going<br>
                  >         >>> down -- alerts are designed
                  to e.g. email a system<br>
                  >         administrator after<br>
                  >         >>> an important event).<br>
                  >         >>><br>
                  >         >>> For details about clone
                  notifications, see:<br>
                  >         >>><br>
                  >         >>><br>
                  >         <a href="http://clusterlabs.org/doc/en-US/Pacemaker/1.1-pcs/html-sing" rel="noreferrer" target="_blank">http://clusterlabs.org/doc/<wbr>en-US/Pacemaker/1.1-pcs/html-<wbr>sing</a><br>
                  >         >>><br>
                  >         le/Pacemaker_Explained/index.<wbr>html#_clone_resource_agent_req<wbr>uirements<br>
                  >         >>><br>
                  >         >>> The RA must support the
                  "notify" action, which will be<br>
                  >         called when a<br>
                  >         >>> clone instance is started or
                  stopped. See the similar<br>
                  >         section later for<br>
                  >         >>> master/slave resources for
                  additional information. See the<br>
                  >         mysql or<br>
                  >         >>> pgsql resource agents for
                  examples of notify<br>
                  >         implementations.<br>
                  >         >>><br>
                  >         >>> > I was exploring
                  "notification agent" and "notification<br>
                  >         recipient"<br>
                  >         >>> > features, but that
                  doesn't seem to<br>
                  >         work. /etc/sysconfig/notify.sh<br>
                  >         >>> > doesn't get invoked
                  even in the newly elected active<br>
                  >         node.<br>
                  >         >>><br>
                  >         >>> Yep, that's something
                  different altogether -- it's only<br>
                  >         enabled on RHEL<br>
                  >         >>> systems, and solely for
                  backward compatibility with an<br>
                  >         early<br>
                  >         >>> implementation of the alerts
                  interface. The new alerts<br>
                  >         interface is more<br>
                  >         >>> flexible, but it's not
                  designed to send information<br>
                  >         between cluster<br>
                  >         >>> nodes -- it's designed to
                  send information to something<br>
                  >         external to the<br>
                  >         >>> cluster, such as a human, or
                  an SNMP server, or a<br>
                  >         monitoring system.<br>
                  >         >>><br>
                  >         >>><br>
                  >         >>> > Cluster Properties:<br>
                  >         >>> > 
                  cluster-infrastructure: corosync<br>
                  >         >>> >  dc-version:
                  1.1.17-e2e6cdce80<br>
                  >         >>> > 
                  default-action-timeout: 240<br>
                  >         >>> >  have-watchdog: false<br>
                  >         >>> >  no-quorum-policy:
                  ignore<br>
                  >         >>> >  notification-agent:
                  /etc/sysconfig/notify.sh<br>
                  >         >>> > 
                  notification-recipient: /var/log/notify.log<br>
                  >         >>> >  placement-strategy:
                  balanced<br>
                  >         >>> >  stonith-enabled: false<br>
                  >         >>> >  symmetric-cluster:
                  false<br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> > I m using the following
                  versions of pacemaker and<br>
                  >         corosync.<br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> > /usr/sbin #
                  ./pacemakerd --version<br>
                  >         >>> > Pacemaker 1.1.17<br>
                  >         >>> > Written by Andrew
                  Beekhof<br>
                  >         >>> > /usr/sbin # ./corosync
                  -v<br>
                  >         >>> > Corosync Cluster
                  Engine, version '2.3.5'<br>
                  >         >>> > Copyright (c) 2006-2009
                  Red Hat, Inc.<br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> > Can you please suggest
                  if I m doing anything wrong or if<br>
                  >         there any<br>
                  >         >>> > other mechanisms to
                  achieve this ?<br>
                  >         >>> ><br>
                  >         >>> ><br>
                  >         >>> > Regards,<br>
                  >         >>> > Sriram.<br>
                  <br>
                </div>
              </div>
              <div class="m_-4802990479422366187gmail-HOEnZb">
                <div class="m_-4802990479422366187gmail-h5">--<br>
                  Ken Gaillot <<a href="mailto:kgaillot@redhat.com" target="_blank">kgaillot@redhat.com</a>><br>
                  <br>
                  <br>
                  <br>
                  <br>
                  <br>
                  ______________________________<wbr>_________________<br>
                  Users mailing list: <a href="mailto:Users@clusterlabs.org" target="_blank">Users@clusterlabs.org</a><br>
                  <a href="http://lists.clusterlabs.org/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.clusterlabs.org/m<wbr>ailman/listinfo/users</a><br>
                  <br>
                  Project Home: <a href="http://www.clusterlabs.org" rel="noreferrer" target="_blank">http://www.clusterlabs.org</a><br>
                  Getting started: <a href="http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf" rel="noreferrer" target="_blank">http://www.clusterlabs.org/doc<wbr>/Cluster_from_Scratch.pdf</a><br>
                  Bugs: <a href="http://bugs.clusterlabs.org" rel="noreferrer" target="_blank">http://bugs.clusterlabs.org</a><br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
      </div>
      <br>
      <fieldset class="m_-4802990479422366187mimeAttachmentHeader"></fieldset>
      <br>
      <pre>______________________________<wbr>_________________
Users mailing list: <a class="m_-4802990479422366187moz-txt-link-abbreviated" href="mailto:Users@clusterlabs.org" target="_blank">Users@clusterlabs.org</a>
<a class="m_-4802990479422366187moz-txt-link-freetext" href="http://lists.clusterlabs.org/mailman/listinfo/users" target="_blank">http://lists.clusterlabs.org/<wbr>mailman/listinfo/users</a>

Project Home: <a class="m_-4802990479422366187moz-txt-link-freetext" href="http://www.clusterlabs.org" target="_blank">http://www.clusterlabs.org</a>
Getting started: <a class="m_-4802990479422366187moz-txt-link-freetext" href="http://www.clusterlabs.org/doc/Cluster_from_Scratch.pdf" target="_blank">http://www.clusterlabs.org/<wbr>doc/Cluster_from_Scratch.pdf</a>
Bugs: <a class="m_-4802990479422366187moz-txt-link-freetext" href="http://bugs.clusterlabs.org" target="_blank">http://bugs.clusterlabs.org</a>
</pre>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>