Re: How to send slack notification to multiple channels.

Dhanasekaran Anbalagan <[email protected]> Fri, 21 Dec 2018 18:14:42 -0500
Newsgroups gmane.network.opennms.general
Message-ID <CAJzooYdQRrjMdtn9kLdgg6rA4OxQiw4dNsORP75h2mqvuCpD1g@mail.gmail.com>
--===============4344101148156783653==
Content-Type: multipart/alternative; boundary="00000000000034af3d057d906afb"

--00000000000034af3d057d906afb
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Hi Ron,

Thanks for your email.

can you please guide me how to add the additional parameters to the in XML
block.

https://docs.opennms.org/opennms/releases/22.0.4/guide-admin/guide-admin.ht=
ml#ga-notifications-strategy-slack

=3D=3D=3D
    <command binary=3D"false">
        <name>slack</name>

<execute>org.opennms.netmgt.notifd.SlackNotificationStrategy</execute>
        <comment>Slack Notifications</comment>
        <argument streamed=3D"false">
            <switch>-subject</switch>
        </argument>
        <argument streamed=3D"false">
            <switch>-tm</switch>
        </argument>
*        <argument streamed=3D"false">*
*           <substitution>channel</substitution>*
*        </argument>*
*        <argument streamed=3D"false">*
*           <substitution>#dev</substitution>*
*        </argument>*
    </command>
=3D=3D=3D

after chaning config file. I am getting this exception:

=3D=3D=3D=3D
2018-12-21 18:09:59,705 ERROR [NotificationTask-3] o.o.n.n.ClassExecutor:
Throwable received while sending message
java.lang.NullPointerException: null
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getSw=
itchValue(AbstractSlackCompatibleNotificationStrategy.java:220)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getVa=
lueFromSwitchOrProp(AbstractSlackCompatibleNotificationStrategy.java:194)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getUr=
l(AbstractSlackCompatibleNotificationStrategy.java:144)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.send(=
AbstractSlackCompatibleNotificationStrategy.java:77)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.java:69)
[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:274)
[opennms-services-22.0.4.jar:?]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1=
149)
[?:1.8.0_181]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:=
624)
[?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
2018-12-21 18:09:59,705 ERROR [NotificationTask-2] o.o.n.n.ClassExecutor:
Throwable received while sending message
java.lang.NullPointerException: null
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getSw=
itchValue(AbstractSlackCompatibleNotificationStrategy.java:220)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getVa=
lueFromSwitchOrProp(AbstractSlackCompatibleNotificationStrategy.java:194)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getUr=
l(AbstractSlackCompatibleNotificationStrategy.java:144)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.send(=
AbstractSlackCompatibleNotificationStrategy.java:77)
~[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.java:69)
[opennms-services-22.0.4.jar:?]
        at
org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java:274)
[opennms-services-22.0.4.jar:?]
        at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1=
149)
[?:1.8.0_181]
        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:=
624)
[?:1.8.0_181]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]

=3D=3D=3D=3D

-Dhanasekaran.

Did I learn something today? If not, I wasted it.


On Thu, Dec 20, 2018 at 2:28 PM Ronald Roskens <[email protected]> wrote:

> If you add an argument =E2=80=9Cchannel=E2=80=9D to your slack notificati=
on command, then
> it will either use the system property
> (org.opennms.netmgt.notifd.slack.channel) or the value for a parameter
> =E2=80=9Cchannel=E2=80=9D from the notification.
>
> Ron
>
> On Dec 20, 2018, at 9:23 AM, Dhanasekaran Anbalagan <[email protected]>
> wrote:
>
> Hi Guys,
>
> I would like to know, How to configure the slack notification for multipl=
e
> slack channels?
>
> for example, in our case, we have multiple Provisioning Requisitions
> groups.  if node sending some notification means to send corresponding
> provisioning requisitions group slack channel.
>
> dev-nodes --> #dev
> prod-nodes --> #prod
>
> currently, it's sending all the notification to one common slack channel.
>
> Please guide me. How to configure this.
>
> -Dhanasekaran.
>
> Did I learn something today? If not, I wasted it.
> ________________________________________________________________
> Note that this mailing list is not as active as other resources.
>
> Visit https://opennms.discourse.group/ for the forum, and
> visit https://chat.opennms.com for real-time chat.
> ________________________________________________________________
>
> opennms-discuss mailing list
>
> To *unsubscribe* or change your subscription options, see the bottom of
> this page:
> https://lists.sourceforge.net/lists/listinfo/opennms-discuss
>
>
> ________________________________________________________________
> Note that this mailing list is not as active as other resources.
>
> Visit https://opennms.discourse.group/ for the forum, and
> visit https://chat.opennms.com for real-time chat.
> ________________________________________________________________
>
> opennms-discuss mailing list
>
> To *unsubscribe* or change your subscription options, see the bottom of
> this page:
> https://lists.sourceforge.net/lists/listinfo/opennms-discuss

--00000000000034af3d057d906afb
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div di=
r=3D"ltr">Hi Ron,<div><br></div><div>Thanks for your email.</div><div><br><=
/div><div>can you please guide me how to add the additional parameters to t=
he in XML block.=C2=A0</div><div><br></div><div><a href=3D"https://docs.ope=
nnms.org/opennms/releases/22.0.4/guide-admin/guide-admin.html#ga-notificati=
ons-strategy-slack">https://docs.opennms.org/opennms/releases/22.0.4/guide-=
admin/guide-admin.html#ga-notifications-strategy-slack</a><br></div><div><b=
r></div><div>=3D=3D=3D</div><div><div>=C2=A0 =C2=A0 &lt;command binary=3D&q=
uot;false&quot;&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;name&gt;slack=
&lt;/name&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;execute&gt;org.open=
nms.netmgt.notifd.SlackNotificationStrategy&lt;/execute&gt;</div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 &lt;comment&gt;Slack Notifications&lt;/comment&gt;=
</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;argument streamed=3D&quot;false&=
quot;&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;switch&gt=
;-subject&lt;/switch&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;/argumen=
t&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;argument streamed=3D&quot;f=
alse&quot;&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;swit=
ch&gt;-tm&lt;/switch&gt;</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;/argumen=
t&gt;</div><div><div><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;argument streamed=
=3D&quot;false&quot;&gt;</i></div><div><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0&lt;substitution&gt;channel&lt;/substitution&gt;</i></div><div><i=
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;/argument&gt;</i></div><div><i>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 &lt;argument streamed=3D&quot;false&quot;&gt;</i></div><d=
iv><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0&lt;substitution&gt;#dev&lt;=
/substitution&gt;</i></div><div><i>=C2=A0 =C2=A0 =C2=A0 =C2=A0 &lt;/argumen=
t&gt;</i></div></div><div>=C2=A0 =C2=A0 &lt;/command&gt;</div></div><div>=
=3D=3D=3D</div><div><br></div><div>after chaning config file. I am getting =
this exception:</div><div><br></div><div>=3D=3D=3D=3D</div><div><div>2018-1=
2-21 18:09:59,705 ERROR [NotificationTask-3] o.o.n.n.ClassExecutor: Throwab=
le received while sending message</div><div>java.lang.NullPointerException:=
 null</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.netmgt.notifd.Ab=
stractSlackCompatibleNotificationStrategy.getSwitchValue(AbstractSlackCompa=
tibleNotificationStrategy.java:220) ~[opennms-services-22.0.4.jar:?]</div><=
div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.netmgt.notifd.AbstractSlackC=
ompatibleNotificationStrategy.getValueFromSwitchOrProp(AbstractSlackCompati=
bleNotificationStrategy.java:194) ~[opennms-services-22.0.4.jar:?]</div><di=
v>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.netmgt.notifd.AbstractSlackCom=
patibleNotificationStrategy.getUrl(AbstractSlackCompatibleNotificationStrat=
egy.java:144) ~[opennms-services-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 at org.opennms.netmgt.notifd.AbstractSlackCompatibleNotification=
Strategy.send(AbstractSlackCompatibleNotificationStrategy.java:77) ~[opennm=
s-services-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.openn=
ms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.java:69) [opennms-serv=
ices-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.net=
mgt.notifd.NotificationTask.run(NotificationTask.java:274) [opennms-service=
s-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at java.util.concurre=
nt.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_181]=
</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at java.util.concurrent.ThreadPoolEx=
ecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_181]</div><div>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 at java.lang.Thread.run(Thread.java:748) [?:1.8.0_=
181]</div><div>2018-12-21 18:09:59,705 ERROR [NotificationTask-2] o.o.n.n.C=
lassExecutor: Throwable received while sending message</div><div>java.lang.=
NullPointerException: null</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.ope=
nnms.netmgt.notifd.AbstractSlackCompatibleNotificationStrategy.getSwitchVal=
ue(AbstractSlackCompatibleNotificationStrategy.java:220) ~[opennms-services=
-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.netmgt.=
notifd.AbstractSlackCompatibleNotificationStrategy.getValueFromSwitchOrProp=
(AbstractSlackCompatibleNotificationStrategy.java:194) ~[opennms-services-2=
2.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.netmgt.no=
tifd.AbstractSlackCompatibleNotificationStrategy.getUrl(AbstractSlackCompat=
ibleNotificationStrategy.java:144) ~[opennms-services-22.0.4.jar:?]</div><d=
iv>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at org.opennms.netmgt.notifd.AbstractSlackCo=
mpatibleNotificationStrategy.send(AbstractSlackCompatibleNotificationStrate=
gy.java:77) ~[opennms-services-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0=
 =C2=A0 at org.opennms.netmgt.notifd.ClassExecutor.execute(ClassExecutor.ja=
va:69) [opennms-services-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 at org.opennms.netmgt.notifd.NotificationTask.run(NotificationTask.java=
:274) [opennms-services-22.0.4.jar:?]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0=
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.ja=
va:1149) [?:1.8.0_181]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at java.util.c=
oncurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8=
.0_181]</div><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 at java.lang.Thread.run(Threa=
d.java:748) [?:1.8.0_181]</div></div><div><br></div><div>=3D=3D=3D=3D</div>=
<div><br></div><div>-Dhanasekaran.</div><div><br clear=3D"all"><div><div di=
r=3D"ltr" class=3D"gmail_signature">Did I learn something today? If not, I =
wasted it.</div></div><br></div></div></div></div></div></div><br><div clas=
s=3D"gmail_quote"><div dir=3D"ltr">On Thu, Dec 20, 2018 at 2:28 PM Ronald R=
oskens &lt;<a href=3D"mailto:[email protected]">[email protected]</a>&gt; w=
rote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0p=
x 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style=
=3D"overflow-wrap: break-word;"><div>If you add an argument =E2=80=9Cchanne=
l=E2=80=9D to your slack notification command, then it will either use the =
system property (org.opennms.netmgt.notifd.slack.channel) or the value for =
a parameter =E2=80=9Cchannel=E2=80=9D from the notification.</div><div><br>=
</div><div>Ron</div><div><div><div><br><blockquote type=3D"cite"><div>On De=
c 20, 2018, at 9:23 AM, Dhanasekaran Anbalagan &lt;<a href=3D"mailto:bugcy0=
[email protected]" target=3D"_blank">[email protected]</a>&gt; wrote:</div><br =
class=3D"gmail-m_-3522629863308826893Apple-interchange-newline"><div><div d=
ir=3D"ltr"><font face=3D"arial, helvetica, sans-serif" style=3D"background-=
color:rgb(255,255,255)">Hi Guys,</font><div><font face=3D"arial, helvetica,=
 sans-serif" style=3D"background-color:rgb(255,255,255)"><br></font></div><=
div><font face=3D"arial, helvetica, sans-serif" style=3D"background-color:r=
gb(255,255,255)">I would like to know, How to configure the slack notificat=
ion for multiple slack channels?</font></div><div><font face=3D"arial, helv=
etica, sans-serif" style=3D"background-color:rgb(255,255,255)"><br></font><=
/div><div><font face=3D"arial, helvetica, sans-serif" style=3D"background-c=
olor:rgb(255,255,255)">for example, in our case, we have multiple=C2=A0Prov=
isioning Requisitions groups.=C2=A0 if node sending some notification means=
 to send corresponding provisioning requisitions group slack channel.</font=
></div><div><font face=3D"arial, helvetica, sans-serif" style=3D"background=
-color:rgb(255,255,255)"><br></font></div><div><font face=3D"arial, helveti=
ca, sans-serif" style=3D"background-color:rgb(255,255,255)">dev-nodes --&gt=
; #dev<br></font></div><div><font face=3D"arial, helvetica, sans-serif" sty=
le=3D"background-color:rgb(255,255,255)">prod-nodes --&gt; #prod</font></di=
v><div><br></div><div>currently, it&#39;s sending all the notification to o=
ne common slack channel.</div><div><br></div><div>Please guide me. How to c=
onfigure this.</div><div><br></div><div>-Dhanasekaran.</div><div><font face=
=3D"arial, helvetica, sans-serif" style=3D"background-color:rgb(255,255,255=
)"><br clear=3D"all"></font><div><div dir=3D"ltr" class=3D"gmail-m_-3522629=
863308826893gmail_signature"><font face=3D"arial, helvetica, sans-serif" st=
yle=3D"background-color:rgb(255,255,255)">Did I learn something today? If n=
ot, I wasted it.</font></div></div></div></div>
________________________________________________________________<br>Note th=
at this mailing list is not as active as other resources.<br><br>Visit <a h=
ref=3D"https://opennms.discourse.group/" target=3D"_blank">https://opennms.=
discourse.group/</a> for the forum, and<br>visit <a href=3D"https://chat.op=
ennms.com" target=3D"_blank">https://chat.opennms.com</a> for real-time cha=
t.<br>________________________________________________________________<br><=
br>opennms-discuss mailing list<br><br>To *unsubscribe* or change your subs=
cription options, see the bottom of this page:<br><a href=3D"https://lists.=
sourceforge.net/lists/listinfo/opennms-discuss" target=3D"_blank">https://l=
ists.sourceforge.net/lists/listinfo/opennms-discuss</a></div></blockquote><=
/div><br></div></div></div>________________________________________________=
________________<br>
Note that this mailing list is not as active as other resources.<br>
<br>
Visit <a href=3D"https://opennms.discourse.group/" rel=3D"noreferrer" targe=
t=3D"_blank">https://opennms.discourse.group/</a> for the forum, and<br>
visit <a href=3D"https://chat.opennms.com" rel=3D"noreferrer" target=3D"_bl=
ank">https://chat.opennms.com</a> for real-time chat.<br>
________________________________________________________________<br>
<br>
opennms-discuss mailing list<br>
<br>
To *unsubscribe* or change your subscription options, see the bottom of thi=
s page:<br>
<a href=3D"https://lists.sourceforge.net/lists/listinfo/opennms-discuss" re=
l=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/list=
info/opennms-discuss</a></blockquote></div>

--00000000000034af3d057d906afb--


--===============4344101148156783653==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============4344101148156783653==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

________________________________________________________________
Note that this mailing list is not as active as other resources.

Visit https://opennms.discourse.group/ for the forum, and
visit https://chat.opennms.com for real-time chat.
________________________________________________________________

opennms-discuss mailing list

To *unsubscribe* or change your subscription options, see the bottom of this page:
https://lists.sourceforge.net/lists/listinfo/opennms-discuss
--===============4344101148156783653==--