Can I make MySQL database as an SNMP agent

Hi guys,

Happy new year for all and live in peace!

I have one sensor sending the values to my MySQL database and I want to be able to send those values which are stored in the database to any of SNMP server using SNMP v1/2c/or 3, can I do that? and if yes is there any help of that?

Which I think to make my own server which stored the data to be like SNMP agent! Right?

As I recall it, it should be a fairly straightforward network sockets task to send data from your database up to an SNMP server. All you need to do is retrieve the data from MySQL, then connect to the SNMP server and send it. The protocol is well documented - I once wrote a very simple SNMP server to monitor some local devices, and I didn’t do it by packet sniffing.

How familiar are you with sockets connections in PHP? And how familiar are you with retrieving data from MySQL? If you have those two skills, and a bit of searching to find the SNMP protocol, that should be enough to get it running.

1 Like

@droopsnoot Thanks for your guidance :sweat_smile:

I know how to retrieve MySQL data but in php socket just don’t know it. Could you recommend something useful

Not really, I’m sure there are plenty of tutorials out there. (ETA that sounds unhelpful, but when I was messing with this I was doing it as part of my job, so I could spend time looking for code, experimenting and so on.)

There’s a simple TCP/IP client example on the official docs page: PHP: Examples - Manual so it may just be a case of altering port names and going from there.