2018年1月16日 星期二

pysnmp startup

DOWNLOAD...
https://github.com/xfguo/pysnmp
http://snmplabs.com/pysnmp/
https://pypi.python.org/pypi/pysnmp/#downloads

INSTALL...
tar zxf package-X.X.X.tar.gz
cd package-X.X.X
python setup.py install
or...
pip install pysnmp
or...
easy_install pysnmp

EXAMPLE...
read…
http://www.nealc.com/blog/blog/2013/02/23/writing-an-snmp-agent-with-a-custom-mib-using-pysnmp/
readwrite…
http://www.cloud-rocket.com/2013/08/writing-custom-mib-for-pysnmp-agent/

1.create mib file MY-MIB
2.convert mib to py...
        build-pysnmp-mib -o MY-MIB.py MY-MIB
3.modify ip, get, trap functions
4.stop net-snmp
        service snmpd stop
        sudo update-rc.d snmpd disable
5.run example

        modify...
                ntfOrg = ntforg.NotificationOriginator(self._snmpContext)
        to...
                ntfOrg = ntforg.NotificationOriginator()
                ntfOrg.snmpContext = self._snmpContext

FIREWALL...
sudo iptables -A INPUT -p udp --dport 161 -j ACCEPT
or...
sudo ufw allow 161/udp

MIB BROWSER...
http://www.ireasoning.com/downloadmibbrowserfree.php

更高效處理 micro second 的方式

更高效處理 micro second 的方式…  以 STM32 為例… __IO unsigned long sys_tick = 0; void SysTick_Handler(void) {     HAL_IncTick();     sys_tick += (SysTi...