[Xymon] [xymon] SNMP destination (eg. not DevMon) [SOLVED]
Brian Majeska
brian at majeska.com
Mon Feb 28 21:20:55 CET 2011
Here you go, its not pretty but it works, you'll need to adjust the
variable path values as needed for your Xymon installation.
---------------- script ------------------------
#!/bin/sh -x
#
# $1 - Time stamp
# $2 - OID
# $3 - Severity Status
# $4 - Hostname (or IP)
# $5 - Message
XYMONCMD=/local/xymon/server/bin/xymoncmd
XYMONCFG=/local/xymon/server/etc/xymonserver.cfg
TRAPCLIENT=/local/xymon/server/ext/trap.pl
LOG=/var/log/snmp/trap.log
NODE="$4"
MSG="$5"
GHOST=yes # yes - nodes not in DNS end up in the Xymon ghost report
# no - nodes not in DNS send status to
unknown-trap-host host you need to setup in Xymon (bb-)hosts.cfg:
0.0.0.0 unknown-trap-host # noconn testip
### Test to see if its a valid hostname or IP
if ( host ${NODE} >/dev/null 2>&1 ); then
### Get FQDN from host or IP provided
if ( echo ${NODE} |grep
'^[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}$' >/dev/null
2>&1 ); then
FQDN=`host ${NODE} | awk '{print $5}'`
else
FQDN=`host ${NODE} | awk '{print $1}'`
fi
else
### Decide if unknown trap hosts go to the ghost report or a special host
if [ "${GHOST}" = 'yes' ]; then
FQDN=${NODE}
else
FQDN='unknown-trap-host'
MSG="${MSG} - Unknown Host: ${NODE}"
fi
fi
FQDN=`echo ${FQDN} | sed 's/-man//'`
${XYMONCMD} --env=${XYMONCFG} ${TRAPCLIENT} -C -D -s $3 -t ${FQDN} -d
"$1" -m "${MSG} ($2)" >> $LOG
------------end script---------------------
--
Brian Majeska
On Thu, Feb 24, 2011 at 6:51 AM, Josephine Tsikoudaki
<jtsikoudaki at ontelecoms.com> wrote:
>
> Hello
>
> Can you help on how you did that? I have my snmp traps coming with IPs and
> hobbit wont display them...
>
> Thanks!
>
> Josephine
>
>
> On Sun, 2011-01-16 at 17:50 -0800, Brian Majeska wrote:
>
> Yes, you can have a separate trap column for each host. The trap.sh
> script that comes in the tar download on that page feeds the IP or
> hostname to the trap.pl script which reports the status to Xymon.
>
> I tweaked my trap.sh script to do dns lookups for all traps that come
>
> in without a hostname so they can be reported to xymon with the
> correct hostname.
>
> --
> Brian Majeska
>
>
>
> On Fri, Jan 14, 2011 at 2:19 PM, Ryan Novosielski <novosirj at umdnj.edu>
> wrote:
>> -----BEGIN PGP SIGNED MESSAGE-----
>> Hash: SHA1
>>
>> The only thing that isn't clear is whether it would be possible to split
>> the things out and have them show up under the equipment that they
>> originate from (eg. a trap comes from a monitored server that I have --
>> can I have it show up as an issue under than server rather than one
>> thing that just says "traps" under the Xymon server status). But I
>> haven't looked at all, so we'll see.
>>
>> On 01/14/2011 05:11 PM, Xymon User in Richmond wrote:
>>> Way kewl. Canned version of a WAG definitely beats rolling your own.
>>>
>>> On Fri, January 14, 2011 16:56, Ryan Novosielski wrote:
>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>>
>>>> Thanks a bunch! I had sniffed around some and had read an FAQ or two but
>>>> only saw DevMon. The relevant link here is:
>>>>
>>>> http://cerebro.victoriacollege.edu/hobbit-trap.html
>>>>
>>>> Have a nice weekend!
>>>>
>>>> On 01/14/2011 04:31 PM, Williams, Doug (Consultant-RIC) wrote:
>>>>> http://en.wikibooks.org/wiki/System_Monitoring_with_Xymon/Other_Docs/FA
>>>>> Q #Q._How_do_I_enable_SNMP_monitoring_with_Hobbit_Server.3F
>>>>>
>>>>>
>>>>> -----Original Message----- From: Xymon User in Richmond
>>>>> [mailto:hobbit at epperson.homelinux.net] Sent: Friday, January 14, 2011
>>>>> 4:15 PM To: xymon at xymon.com Subject: Re: [xymon] SNMP destination (eg.
>>>>> not DevMon)
>>>>>
>>>>> On Fri, January 14, 2011 15:52, Ryan Novosielski wrote:
>>>>>> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> Is anyone aware of any direction I might look for supporting
>>>>>> RECEIVING SNMP traps from devices (not querying them via SNMP)? I
>>>>>> have a device that can set an SNMP destination, but I don't believe
>>>>>> has support for being queried by SNMP (if it does, it is a slightly
>>>>>> moot point as it
>>>>> is
>>>>>> not on a network that can be accessed easily remotely).
>>>>>>
>>>>>> Happy to just hear the name of a script or software if you know of
>>>>> one.
>>>>>
>>>>> Just a WAG, but I'd try pointing it at an snmptrapd and then monitor
>>>>> the log. But maybe someone knows a better way.
>>>>>
>>>>>
>>>>> To unsubscribe from the xymon list, send an e-mail to
>>>>> xymon-unsubscribe at xymon.com
>>>>>
>>>>>
>>>>>
>>>>> To unsubscribe from the xymon list, send an e-mail to
>>>>> xymon-unsubscribe at xymon.com
>>>>>
>>>>>
>>>>
>>>>
>>>> - -- - ---- _ _ _ _ ___ _ _ _ |Y#| | | |\/| | \ |\ | | |Ryan
>>>> Novosielski - Sr. Systems Programmer |$&| |__| | | |__/ | \| _|
>>>> |novosirj at umdnj.edu - 973/972.0922 (2-0922) \__/ Univ. of Med. and
>>>> Dent.|IST/CST-Academic Svcs. - ADMC 450, Newark -----BEGIN PGP
>>>> SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG
>>>> with Mozilla - http://enigmail.mozdev.org/
>>>>
>>>> iEYEARECAAYFAk0wxpoACgkQmb+gadEcsb4b3QCgyAf7MQStVNu1wZh7d8DU9Iyq
>>>> XSoAoKuv7aM3KCiP7QlFnDlBBjvTfQSa =2CvN -----END PGP SIGNATURE-----
>>>>
>>>> To unsubscribe from the xymon list, send an e-mail to
>>>> xymon-unsubscribe at xymon.com
>>>>
>>>
>>>
>>>
>>> To unsubscribe from the xymon list, send an e-mail to
>>> xymon-unsubscribe at xymon.com
>>>
>>>
>>
>>
>> - --
>> - ---- _ _ _ _ ___ _ _ _
>> |Y#| | | |\/| | \ |\ | | |Ryan Novosielski - Sr. Systems Programmer
>> |$&| |__| | | |__/ | \| _| |novosirj at umdnj.edu - 973/972.0922 (2-0922)
>> \__/ Univ. of Med. and Dent.|IST/CST-Academic Svcs. - ADMC 450, Newark
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.10 (GNU/Linux)
>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>>
>> iEYEARECAAYFAk0wy/gACgkQmb+gadEcsb647wCfZ90Oo0b3rvhnHfdJNKjek0I2
>> znwAn311dNn6ebXTpf9ZOQkVQfPhtZb9
>> =b6gV
>> -----END PGP SIGNATURE-----
>>
>>
>> To unsubscribe from the xymon list, send an e-mail to
>> xymon-unsubscribe at xymon.com
>>
>>
>
> To unsubscribe from the xymon list, send an e-mail to
> xymon-unsubscribe at xymon.com
>
>
>
> _______________________________________________
> Xymon mailing list
> Xymon at xymon.com
> http://lists.xymon.com/mailman/listinfo/xymon
>
>
More information about the Xymon
mailing list