星期二, 5月 20, 2025

net snmp

 /etc/snmp/snmpd.conf

rocommunity public

agentAddress udp:161

pass .1.3.6.1.4.1.55554 /bin/bash /snmp.sh



 /snmp.sh
#!/bin/bash

opt=$1
oid=$2

echo "$(date) - called with opt=$opt oid=$oid" >> /tmp/snmp_script.log

if [ "$opt" = "-g" ]; then
  case "$oid" in
    ".1.3.6.1.4.1.55554.1.1.0")
      echo "$oid"
      echo "INTEGER"
      echo "1"
      ;;
    ".1.3.6.1.4.1.55554.1.2.0")
      echo "$oid"
      echo "STRING"
      echo "IPCamModelX"
      ;;
    *)
      exit 1
      ;;
  esac

elif [ "$opt" = "-n" ]; then
  # 簡單示範,回傳下一個 OID
  if [ "$oid" = ".1.3.6.1.4.1.55554.1.1.0" ]; then
    echo ".1.3.6.1.4.1.55554.1.2.0"
    echo "STRING"
    echo "IPCamModelX"
  else
    exit 1
  fi

elif [ "$opt" = "-s" ]; then
  # 如果要支援 set,這邊寫set邏輯
  exit 1

else
  exit 1
fi

Agent

 /usr/sbin/snmpd -V -f -Lo -C -c /etc/snmp/snmpd.conf -Dpass,persist,mib_modules


Client
snmpwalk -v2c -c public localhost .1.3.6.1.4.1.55554.1.1.0


Output
iso.3.6.1.4.1.55554.1.1.0 = INTEGER: 1


星期五, 5月 16, 2025

Pure RTSP over Websocket Player build in browser

 https://anzal.hashnode.dev/a-beginners-guide-to-rtsp-streaming-with-websockets-using-nodejs-and-ffmpeg

A Beginner’s Guide to RTSP Streaming with WebSockets Using Node.js and FFmpeg.