How to receive SNMP traps using net-snmp API? - snmp

How can I receive traps using C or C++ and net-snmp module. I need sample code but the examples at http://www.net-snmp.org/ use syscalls but not API methods.

The net-snmp site does have comprehensive coding tutorials.
Look at http://www.net-snmp.org/wiki/index.php/Tutorials#Coding_Tutorials
EDIT:
Also see source code for snmptrapd as a guide for how to receive traps.

Related

How would I update the title of a YouTube livebroadcast via a Bash script?

I have a YouTube channel that has a number of live broadcasts throughout the week, I am just looking for a way for the Title and Description to be updated via a crontab.
I have see seen the following link. https://developers.google.com/youtube/v3/live/docs/liveBroadcasts/update
To be honest I cant make any sense of it.
Any help offered greatly appreciated.
You're in front of a non-trivial API, but that should not discourage you to go ahead with it.
I'd recommend Python as implementation language: go use the Google's APIs Client Library for Python.
Basically, this library is of good quality and (compared to other client libraries) simple to use. It will, for example, insulate you from having to deal explicitly with REST API calls, JSON and the like. Your code will also work under both GNU/Linux and Windows.
You may begin your journey by reading the official getting started docs: Python Quickstart and YouTube Live Streaming API Overview. Then I recommend absorbing these two important documents: Life of a Broadcast and Understanding Broadcasts and Streams.
Then go read, understand and run the following sample program from Google: create_broadcast.py. Of course, you'll have to adapt that code to your use case.
You'll have to exercise patience and perseverance (since I imply that you have no prior experience using the YouTube Data API). Using this API will pay off to you at the end of your (programming) journey.
A special mention: for to be able to call the live streaming APIs you will first need to get acquainted with the things related to the so-called OAuth 2.0 authorization and authentication: Implementing OAuth 2.0 Authentication. There's an official document that you need absorb: OAuth 2.0 for Mobile & Desktop Apps.
A few more references: the live streaming API has an official documentation too. The main site documenting the client library is: Google API Client Library for Python Docs. Its source is public, to be found within the client library's public repo under the directory docs.
Also useful is to see the YouTube Data API's list of all instance methods.

Adventnet library for snmp v3 traps

I am having a hard time to decrypt snmp v3 messages using adventnet library whereas snmp4j works just great. I have tried all the examples from adventnet site but none of them seems to work for v3. Can someone help me out plz ?

Protocol Buffers - RPC

I'm trying to have a messaging service(over TCPIP) between windows on PC(running C# app) and linux on an SoC board(running C++ app). I went through Google's protocol buffers and thought that I can serialize the structure (data struct) into a buffer and write this buffer over sockets(saw an example too).
My question, is there another way to do this? What does protocol buffer-RPC do? I went through their documentation but they don't specify on how to do it with TCPIP. Maybe someone has examples for this or detailed documentation?
Thank you,
Karthik.
My question, is there another way to do this?
There are many ways to do this. Google Protocol Buffers is library for cross-platform object serialization. You can share this serialized data in many different ways. My recommendation for you is using ZMQ (ZMQ GUIDE) which is perfectly suited for applications like yours.
I have a similar use case to you. I wrote Linux C++ ZMQ server on Raspberry Pi and Python ZMQ client dedicated for telemetry and remote management purposes. This library is efficient, lightweight, works perfectly with Google Protocol Buffers and has binding to all major programming languages. If you decide to use this library do not hesitate to ask me about working code example.
See if the Google Developers page on how the protocol buffers wire format is encoded helps with your question: https://developers.google.com/protocol-buffers/docs/encoding

open source snmp manager library

I know one can build an snmp client using net snmp. Does anyone know an open source snmp manager library in C? or maybe my understanding is not correct. The net snmp library can also be used to build a snmp manager? I need to build a snmp manager to test my snmp client app.
Thanks.
If all you're interested in is testing, I'd suggest simply using some simple command line tools for sending queries to your agent. The Net-SNMP engine you mentioned would work well, and has many online tutorials for how to send queries to your app. See the Net-SNMP tutorials on the subject.

net-snmp: how should I approach the project of making a bilingual snmpd?

I apologize that this question comes from the uninformed, huddled masses: I've been away from net-snmp for three years and I've missed all of the developments.
I have to deliver a bilingual v2c/v3 snmpd for use in an embedded Linux system.
I expect to use the superb net-snmp sources. What is the right approach to marshalling these sources, where "right" == straightforward, uncomplicated, vanilla, and "it just works"?
Thanks so much, everybody. And I apologize again for my out-of-dateness.
Edit: Why do I need this input? I have a lot of experience with snmp v2c in general; some experience with net-snmp; and little experience with snmp v3. Because I'm new to v3, I'm looking for a cookbook approach from someone who's done it so I can avoid the many undocumented pitfalls and hurdles that my experience tells me lie in the path of anyone building an agent from net-snmp sources.
First, Net-SNMP is already tri-lingual under the hood. If you configure it to accept v1, v2c and v3 it'll happily accept and respond to all 3 protocol versions without changing a thing.
Second, to get snmpv1/2c working, all you need in your snmpd.conf file is:
rocommunity COMMUNITYNAME
Where, COMMUNITYNAME is the super-secret insecure community/password you want to use.
For SNMPv3, I'm assuming you want to use SNMPv3 with USM. I suggest you start by reading the Net-SNMP tutorial on Securing SNMP traffic and go from there.
Note also, you can run snmpconf -g basic_setup to get more help with the above as well as with other options.

Resources