[prev in list] [next in list] [prev in thread] [next in thread] 

List:       opennms-discuss
Subject:    Re: [opennms-discuss] Adding SNMP communities to snmp-config.xml for an ip address range
From:       JohnD Blackburn <johnd.blackburn () au ! abb ! com>
Date:       2018-02-07 1:46:42
Message-ID: DB6PR0602MB2902AEF7CC4FF9153E246A04CBFC0 () DB6PR0602MB2902 ! eurprd06 ! prod ! outlook ! com
[Download RAW message or body]

Thanks Ron,

I'll have a look at that.   Sounds like it might provide what I'm looking f=
or.

Regards,
John








From: Roskens, Ronald [mailto:Ronald.Roskens@biworldwide.com]
Sent: Wednesday, 7 February 2018 12:49 AM
To: 'General OpenNMS Discussion' <opennms-discuss@lists.sourceforge.net>
Subject: Re: [opennms-discuss] Adding SNMP communities to snmp-config.xml f=
or an ip address range

CAUTION: This email originated from outside of the organization. Do not cli=
ck links or open attachments unless you recognize the sender and know the c=
ontent is safe.

I took a quick peek at the SnmpConfigRestService.java in the opennms-webapp=
. It does not currently support anything other than individual ip addresses=
.

However, further review of the code path suggests that sending a specially =
crafted event to the eventbus should trigger a snmp-config.xml update. See =
https://github.com/OpenNMS/opennms/blob/master/opennms-config/src/main/java=
/org/opennms/netmgt/config/SnmpEventInfo.java

$ send-event.pl \
 --interface <first-ip-address> \
  --service SNMP \
  --parm 'PARM_FIRST_IP_ADDRESS <first-ip-address>' \
  --parm 'PARM_LAST_IP_ADDRESS <last-ip-address>' \
  --parm '...' \
uei.opennms.org/internal/configureSNMP

You'll have to look at SnmpEventInfo and EventConstants (https://github.com=
/OpenNMS/opennms/blob/master/features/events/api/src/main/java/org/opennms/=
netmgt/events/api/EventConstants.java) to see what the strings are to use f=
or the various parameters.

Ron

From: JohnD Blackburn [mailto:johnd.blackburn@au.abb.com]
Sent: Monday, February 05, 2018 9:54 PM
To: General OpenNMS Discussion
Subject: Re: [opennms-discuss] Adding SNMP communities to snmp-config.xml f=
or an ip address range

*Bump*

Does anyone have any ideas on this?

Regards,
John








From: JohnD Blackburn [mailto:johnd.blackburn@au.abb.com]
Sent: Wednesday, 31 January 2018 7:02 AM
To: General OpenNMS Discussion <opennms-discuss@lists.sourceforge.net<mailt=
o:opennms-discuss@lists.sourceforge.net>>
Subject: [opennms-discuss] Adding SNMP communities to snmp-config.xml for a=
n ip address range

CAUTION: This email originated from outside of the organization. Do not cli=
ck links or open attachments unless you recognize the sender and know the c=
ontent is safe.

I'm trying to set up an automated script for adding an snmp community to th=
e snmp-config.xml file  for an ip address range.

I've found I can update/add an snmp community for an individual ip address =
using provision.pl, but I'd like to be able to do the same for an ip addres=
s range.

I know I could do this by directly editing the snmp-config.xml file or the =
web interface, but I'd prefer to use a standard OpenNMS api/commandline int=
erface to perform this operation if possible.


How do I perform an add/update of an snmp community string for an ip addres=
s range from the commandline?

I'm running OpenNMS 21.0.2

Regards,
John Blackburn

________________________________
This e-mail message is being sent solely for use by the intended recipient(=
s) and may contain confidential information. Any unauthorized review, use, =
disclosure or distribution is prohibited. If you are not the intended recip=
ient, please contact the sender by phone or reply by e-mail, delete the ori=
ginal message and destroy all copies. Thank you.

[Attachment #3 (text/html)]

<html xmlns:v="urn:schemas-microsoft-com:vml" \
xmlns:o="urn:schemas-microsoft-com:office:office" \
xmlns:w="urn:schemas-microsoft-com:office:word" \
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" \
xmlns="http://www.w3.org/TR/REC-html40"> <head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Verdana;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:ABBvoice;
	panose-1:2 13 6 3 2 5 3 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:#0563C1;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:#954F72;
	text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
	{mso-style-priority:99;
	mso-style-link:"Balloon Text Char";
	margin:0cm;
	margin-bottom:.0001pt;
	font-size:8.0pt;
	font-family:"Tahoma",sans-serif;}
span.BalloonTextChar
	{mso-style-name:"Balloon Text Char";
	mso-style-priority:99;
	mso-style-link:"Balloon Text";
	font-family:"Tahoma",sans-serif;}
span.EmailStyle19
	{mso-style-type:personal;
	font-family:"Verdana",sans-serif;
	color:windowtext;}
span.EmailStyle20
	{mso-style-type:personal;
	font-family:"Verdana",sans-serif;
	color:windowtext;}
span.EmailStyle21
	{mso-style-type:personal;
	font-family:"Calibri",sans-serif;
	color:#1F497D;}
span.EmailStyle22
	{mso-style-type:personal-reply;
	font-family:"Verdana",sans-serif;
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	font-size:10.0pt;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-AU" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US">Thanks \
Ron,<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US">I&#8217;ll \
have a look at that.&nbsp;&nbsp; Sounds like it might provide what I&#8217;m looking \
for.<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US">Regards,<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US">John<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <div>
<p class="MsoNormalCxSpMiddle" style="mso-margin-bottom-alt:auto;mso-add-space:auto">
<span style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormalCxSpMiddle" \
style="mso-margin-bottom-alt:auto;mso-add-space:auto"> <span \
style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormalCxSpMiddle" style="margin-bottom:13.0pt;mso-add-space:auto"><span \
style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p>
 </div>
<p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif;mso-fareast-language:EN-US"><o:p>&nbsp;</o:p></span></p>
 <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> \
Roskens, Ronald [mailto:Ronald.Roskens@biworldwide.com] <br>
<b>Sent:</b> Wednesday, 7 February 2018 12:49 AM<br>
<b>To:</b> 'General OpenNMS Discussion' \
&lt;opennms-discuss@lists.sourceforge.net&gt;<br> <b>Subject:</b> Re: \
[opennms-discuss] Adding SNMP communities to snmp-config.xml for an ip address \
range<o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div style="border:solid #9C6500 1.0pt;padding:2.0pt 2.0pt 2.0pt 2.0pt">
<p class="MsoNormal" style="line-height:12.0pt;background:#FFEB9C"><b><span \
lang="EN-US" style="font-size:10.0pt;color:#9C6500">CAUTION:</span></b><span \
lang="EN-US" style="font-size:10.0pt;color:black"> This email originated from outside \
of the organization.  Do not click links or open attachments unless you recognize the \
sender and know the content is safe.<o:p></o:p></span></p> </div>
<p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif"><o:p>&nbsp;</o:p></span></p> <div>
<p class="MsoNormal"><span lang="EN-US" style="color:#1F497D">I took a quick peek at \
the SnmpConfigRestService.java in the opennms-webapp. It does not currently support \
anything other than individual ip addresses.<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="color:#1F497D">However, further review of the code path suggests \
that sending a specially crafted event to the eventbus should trigger a \
snmp-config.xml update. See <a \
href="https://github.com/OpenNMS/opennms/blob/master/opennms-config/src/main/java/org/opennms/netmgt/config/SnmpEventInfo.java">
 https://github.com/OpenNMS/opennms/blob/master/opennms-config/src/main/java/org/opennms/netmgt/config/SnmpEventInfo.java</a><o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="color:#1F497D">$ send-event.pl \<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="color:#1F497D">&nbsp;--interface \
&lt;first-ip-address&gt; \<o:p></o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="color:#1F497D">&nbsp; --service SNMP \<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="color:#1F497D">&nbsp; --parm \
'PARM_FIRST_IP_ADDRESS &lt;first-ip-address&gt;' \<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="color:#1F497D">&nbsp; --parm \
'PARM_LAST_IP_ADDRESS &lt;last-ip-address&gt;' \<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" style="color:#1F497D">&nbsp; --parm '&#8230;' \
\<o:p></o:p></span></p> <p class="MsoNormal" style="text-indent:5.25pt"><span \
lang="EN-US" style="color:#1F497D">uei.opennms.org/internal/configureSNMP<o:p></o:p></span></p>
 <p class="MsoNormal"><span lang="EN-US" \
style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="color:#1F497D">You'll have to look at SnmpEventInfo and \
EventConstants (<a href="https://github.com/OpenNMS/opennms/blob/master/features/event \
s/api/src/main/java/org/opennms/netmgt/events/api/EventConstants.java">https://github. \
com/OpenNMS/opennms/blob/master/features/events/api/src/main/java/org/opennms/netmgt/events/api/EventConstants.java</a>)
  to see what the strings are to use for the various \
parameters.<o:p></o:p></span></p> <p class="MsoNormal"><span lang="EN-US" \
style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <p class="MsoNormal"><span \
lang="EN-US" style="color:#1F497D">Ron<o:p></o:p></span></p> <p \
class="MsoNormal"><span lang="EN-US" \
style="color:#1F497D"><o:p>&nbsp;</o:p></span></p> <div \
style="border:none;border-left:solid blue 1.5pt;padding:0cm 0cm 0cm 4.0pt"> <div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" \
style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,sans-serif">From:</span></b><span \
lang="EN-US" style="font-size:10.0pt;font-family:&quot;Tahoma&quot;,sans-serif"> \
JohnD Blackburn [<a href="mailto:johnd.blackburn@au.abb.com">mailto:johnd.blackburn@au.abb.com</a>]
 <br>
<b>Sent:</b> Monday, February 05, 2018 9:54 PM<br>
<b>To:</b> General OpenNMS Discussion<br>
<b>Subject:</b> Re: [opennms-discuss] Adding SNMP communities to snmp-config.xml for \
an ip address range<o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">*<b>Bump</b>*<o:p></o:p></span></p>
 <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">Does \
anyone have any ideas on this?<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">Regards,<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">John<o:p></o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <div>
<p class="MsoNormalCxSpMiddle" style="mso-margin-bottom-alt:auto;mso-add-space:auto">
<span style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormalCxSpMiddle" \
style="mso-margin-bottom-alt:auto;mso-add-space:auto"> <span \
style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p>
 <p class="MsoNormalCxSpMiddle" style="margin-bottom:13.0pt;mso-add-space:auto"><span \
style="font-size:9.0pt;font-family:&quot;ABBvoice&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p>
 </div>
<p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US">From:</span></b><span lang="EN-US"> JohnD \
Blackburn [<a href="mailto:johnd.blackburn@au.abb.com">mailto:johnd.blackburn@au.abb.com</a>]
 <br>
<b>Sent:</b> Wednesday, 31 January 2018 7:02 AM<br>
<b>To:</b> General OpenNMS Discussion &lt;<a \
href="mailto:opennms-discuss@lists.sourceforge.net">opennms-discuss@lists.sourceforge.net</a>&gt;<br>
 <b>Subject:</b> [opennms-discuss] Adding SNMP communities to snmp-config.xml for an \
ip address range<o:p></o:p></span></p> </div>
</div>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<div style="border:solid #9C6500 1.0pt;padding:2.0pt 2.0pt 2.0pt 2.0pt">
<p class="MsoNormal" style="line-height:12.0pt;background:#FFEB9C"><b><span \
style="font-size:10.0pt;color:#9C6500">CAUTION:</span></b><span \
style="font-size:10.0pt;color:black"> This email originated from outside of the \
organization. Do not click links or open  attachments unless you recognize the sender \
and know the content is safe.<o:p></o:p></span></p> </div>
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:&quot;Times New \
Roman&quot;,serif"><o:p>&nbsp;</o:p></span></p> <div>
<p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">I&#8217;m trying to set up an \
automated script for adding an snmp community to the snmp-config.xml file &nbsp;for \
an ip address range.<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">I&#8217;ve \
found I can update/add an snmp community for an individual ip address using \
provision.pl, but I&#8217;d like to be able to do the same for an ip address \
range.<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">I know I \
could do this by directly editing the snmp-config.xml file or the web interface, but \
I&#8217;d prefer to use a standard OpenNMS api/commandline interface to perform this \
operation if possible.<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">How do I \
perform an add/update of an snmp community string for an ip address range from the \
commandline?<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">I&#8217;m \
running OpenNMS 21.0.2<o:p></o:p></span></p> <p class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif"><o:p>&nbsp;</o:p></span></p> <p \
class="MsoNormal"><span \
style="font-family:&quot;Verdana&quot;,sans-serif">Regards,<o:p></o:p></span></p> <p \
class="MsoNormal"><span style="font-family:&quot;Verdana&quot;,sans-serif">John \
Blackburn<o:p></o:p></span></p> <p class="MsoNormal"><o:p>&nbsp;</o:p></p>
</div>
</div>
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US" \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif"> <hr size="2" \
width="100%" align="center"> </span></div>
<p class="MsoNormal"><span lang="EN-US" \
style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,serif">This e-mail \
message is being sent solely for use by the intended recipient(s) and may contain \
confidential information. Any unauthorized review, use, disclosure  or distribution \
is prohibited. If you are not the intended recipient, please contact the sender by \
phone or reply by e-mail, delete the original message and destroy all copies. Thank \
you.<o:p></o:p></span></p> </div>
</div>
</body>
</html>


[Attachment #4 (--===============2273334517480031191==)]
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot

_______________________________________________
Please read the OpenNMS Mailing List FAQ:
http://www.opennms.org/index.php/Mailing_List_FAQ

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic