- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Created on 08-29-2018 06:01 PM - edited 08-17-2019 06:37 AM
How to use make a simple flow using SNMPSET/SNMPGET
Append A - Troubleshooting common mistakes
Pre-requisites:
- Nifi Cluster Installed (I'm using HDF 3.1.2.0 hence with Nifi 1.5)
- Centos7
With your NIFI cluster installed, you're up to initiate this step-by-step.
First of all, we'll need to install a snmp server to retrieve/set values of/to MIB's. In my case I'm using net-snmp tool, and it comes with some MIB samples to play. Here we're going to use the SNMPv2-MIB.txt under the /usr/share/snmp/mibs path
1)Install net-snmp
yum install -y net-snmp net-snmp-utils net-snmp-libs
2)Give full access of read-write to anyone at public community (DON'T DO IT IN PROD, please)
echo > /etc/snmp/snmpd.conf printf "agentAddress udp:161\nrwcommunity public\nrwuser public\nrocommunity public default system\nrouser public" >> /etc/snmp/snmpd.conf
3)Start the SNMP SERVER DAEMON - port 161
service snmpd start
4)Test a simple snmpwalk to see if those changes at step 2 are working
snmpwalk -v2c -mALL -c public localhost system
5)Test a simple snmpget
snmpget -v2c -mALL -c public localhost SNMPv2-MIB::sysContact.0
6)Setting a simple value to overwrite the value above, and check again to see if the value has been replaced with the new value
snmpset -v2c -mALL -c public localhost SNMPv2-MIB::sysContact.0 = "Vinicius Higa Murakami" snmpget -v2c -mALL -c public localhost SNMPv2-MIB::sysContact.0
7)Login as nifi user and take the same steps as above (just to ensure that the nifi user has access to read/write)
su - nifi snmpset -v2c -mALL -c public localhost SNMPv2-MIB::sysContact.0 = "Nifi it's here" snmpget -v2c -mALL -c public localhost SNMPv2-MIB::sysContact.0
8)Now we're ready to use nifi and draw the simple flow, using SNMP processors.
Go to nifi UI and draw the following components:
GenerateFlowFile Property
SetSNMP Property
LogAttribute Property
GetSNMP Property
LogAttribute Property
9)Run the nifi flow (snmpset and snmpget) and check if your value is showing up in the nifi-app.log
Append A
To troubleshoot the snmp, you can enable the DEBUG log by adding the following line to the /etc/sysconfig/snmpd
OPTIONS="-A -p /var/run/snmpd -a -LF 7 /var/log/snmpd.log"
And then make some snmpget (step 7) to check if it's logging the connections into the /var/log/snmpd.log. Should appear 2 lines:
Connection from UDP: [127.0.0.1]:40769->[127.0.0.1]:161 Received SNMP packet(s) from UDP: [127.0.0.1]:40769->[127.0.0.1]:161
If you're having issues with the SNMPSET like the below.
Check if your snmpset it's able to reach the snmp server and send snmp packets, to do this, you can use tail -f /var/log/snmpd.log to monitor the connections and start the flow to watch the behaviour.
Other attention point is to check if your nifi has permissions to set/get values from MIB's (make sure you did the step 7).
And lastly is to check if your snmp$oid is valid.
And here's the template used:
template-kb-snmp.xml