How to configure SNMP agent with Quectel Modem

Hi

I have a router with a Quectel EC25 modem and I want to monitor the cell signal with snmp, I am trying to create my OIDs

I have communication with the modem from my router

root@Prototipo0323:~# /sbin/uqmi -d /dev/cdc-wdm0 --get-imei | tr -d '"'

Response OK
864744040306993

I create a script with this command imei

#!/bin/sh
/sbin/uqmi -d /dev/cdc-wdm0 --get-imei | tr -d '"'

I modify /etc/snmp/snmpd.conf with this line

exec .1.3.6.1.4.1.49085.1 detecIMEI /etc/snmp/imei

I have a connection between my laptop and the router via ethernet cable and I check the new OID .1.3.6.1.4.1.49085.1 with Paessler SNMP Tester but return error

Paessler SNMP Tester - 20.2.4 Computername: DESKTOP-MALMMHS Interface: (192.168.23.248, 192.168.1.86)
30/03/2023 06:11:39 p. m. (7 ms) : Device: 192.168.23.1
30/03/2023 06:11:39 p. m. (14 ms) : SNMP v1
30/03/2023 06:11:39 p. m. (20 ms) : Custom OID .1.3.6.1.4.1.49085.1
30/03/2023 06:11:39 p. m. (51 ms) : SNMP Datatype: ASN_NULL
30/03/2023 06:11:39 p. m. (59 ms) : -------
30/03/2023 06:11:39 p. m. (65 ms) : Value: NULL2
30/03/2023 06:11:39 p. m. (72 ms) : Done

someone has created their own OIDs on the agent to be monitored with SNMP

thanks for any guidance

Sergio

If I test uptime works

----------------------- New Test -----------------------
Paessler SNMP Tester - 20.2.4 Computername: DESKTOP-MALMMHS Interface: (192.168.23.248, 192.168.1.86)
30/03/2023 06:24:35 p. m. (3 ms) : Device: 192.168.23.1
30/03/2023 06:24:35 p. m. (9 ms) : SNMP v1
30/03/2023 06:24:35 p. m. (16 ms) : Uptime
30/03/2023 06:24:35 p. m. (29 ms) : SNMP Datatype: ASN_TIMETICKS
30/03/2023 06:24:35 p. m. (36 ms) : -------
30/03/2023 06:24:35 p. m. (72 ms) : DISMAN-EVENT-MIB::sysUpTimeInstance = 132587 ( 22 minutes 5 seconds )
30/03/2023 06:24:35 p. m. (101 ms) : SNMP Datatype: ASN_TIMETICKS
30/03/2023 06:24:35 p. m. (108 ms) : HOST-RESOURCES-MIB::hrSystemUptime.0 = 1955354 ( 5 hours 25 minutes )
30/03/2023 06:24:35 p. m. (116 ms) : Done

I don't know why but checking it generates this additional hierarchy

root@Prototipo0323:~# snmpwalk -v1 -c public localhost .1.3.6.1.4.1.49085.1
SNMPv2-SMI::enterprises.49085.1.1.1 = INTEGER: 1
SNMPv2-SMI::enterprises.49085.1.2.1 = STRING: "detecIMEI"
SNMPv2-SMI::enterprises.49085.1.3.1 = STRING: "/etc/snmp/prueba"
SNMPv2-SMI::enterprises.49085.1.100.1 = INTEGER: 0
SNMPv2-SMI::enterprises.49085.1.101.1 = STRING: "864744040306993"
SNMPv2-SMI::enterprises.49085.1.102.1 = INTEGER: 0
SNMPv2-SMI::enterprises.49085.1.103.1 = ""

and now

----------------------- New Test -----------------------
Paessler SNMP Tester - 20.2.4 Computername: DESKTOP-MALMMHS Interface: (192.168.23.248, 192.168.1.86)
30/03/2023 06:31:35 p. m. (3 ms) : Device: 192.168.23.1
30/03/2023 06:31:35 p. m. (7 ms) : SNMP v1
30/03/2023 06:31:35 p. m. (13 ms) : Custom OID .1.3.6.1.4.1.49085.1.101.1
30/03/2023 06:31:36 p. m. (121 ms) : SNMP Datatype: ASN_OCTET_STR
30/03/2023 06:31:36 p. m. (127 ms) : -------
30/03/2023 06:31:36 p. m. (133 ms) : Value: 864744040306993
30/03/2023 06:31:36 p. m. (138 ms) : Done

Is the /etc/snmp/imei executable? chmod +x /etc/snmp/imei
I am using this:
pass .1.3.6.1.2.1.25.1.8 /bin/sh /root/bin/snmp-cpu-temp
You better use the uci configuration of snmp -> /etc/config/snmpd


config pass
        option name 'temp'
        option prog '/bin/sh /root/bin/snmp-cpu-temp'
        option miboid '.1.3.6.1.2.1.25.1.8'

How can I include these commands in a MIB File?

If I remember correctly, you need to load mib HOST-RESOURCES-MIB and HOST-RESOURCES-TYPES.