
SRCDIR      = `pwd`
OPENPKG     = /cw
RC          = $(OPENPKG)/etc/rc
SNMPGET     = $(OPENPKG)/bin/snmpget
SNMPWALK    = $(OPENPKG)/bin/snmpwalk
SNMPHOSTS   = dv9
SNMPMIBDIR  = $(SRCDIR)/snmpdx.mib:$(OPENPKG)/share/snmp/mibs
SNMPMIBNAME = sysVM


restart:
	@for host in $(SNMPHOSTS); do \
	    echo "==== $$host ===="; \
	    ssh -t root@$$host "$(RC) snmp stop start"; \
	    $(SNMPGET) \
	        -M $(SNMPMIBDIR) -cpublic -v2c -mALL \
            $$host $(SNMPMIBNAME); \
	done

query:
	@for host in $(SNMPHOSTS); do \
	    echo "==== $$host ===="; \
	    $(SNMPWALK) \
	        -M $(SNMPMIBDIR) -cpublic -v2c -mALL \
	        $$host $(SNMPMIBNAME); \
	done

test:
	@>/tmp/snmpdx-thl.log; \
	./snmpdx -g .1.3.6.1.4.1.4007.43.1.1.6.1.1.1.1; \
	./snmpdx -g .1.3.6.1.4.1.4007.43.1.1.6.1.1.2.1; \
	./snmpdx -g .1.3.6.1.4.1.4007.43.1.1.6.1.1.1.2; \
	./snmpdx -g .1.3.6.1.4.1.4007.43.1.1.6.1.1.2.2; \
	echo "    ---- examine results above then press RETURN to see the log ----"; \
	read DUMMY; \
	cat /tmp/snmpdx-thl.log;
	echo "    ---- grepping ----"; \
	fgrep 'trace#' /tmp/snmpdx-thl.log || true

