summaryrefslogtreecommitdiff
path: root/templates/service/snmp/node.def
blob: 9fb161dc2d4b075a80d61e3aa1462d294f796513 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
priority: 980
help: Simple Network Management Protocol (SNMP)
commit:expression: $VAR(community/) != "" || $VAR(community6/) != "" || $VAR(v3/) != "" \
		   ; "must configure a community or community6 or v3"

create: if [ ! -d "/config/snmp" ]; then sudo mkdir /config/snmp ; fi
delete: touch /tmp/snmp.$PPID
end:if [ -f "/tmp/snmp.$PPID" ]
      then
	 sudo /opt/vyatta/sbin/vyatta-snmp.pl --stop-snmp;
         rm /tmp/snmp.$PPID;
	 sudo rm -f /etc/snmp/snmpd.conf;
      else
        if [ -n "$VAR(v3/)" ]; then
	  sudo /opt/vyatta/sbin/vyatta-snmp-v3.pl --check-config;
	  if [ $? != 0 ]; then
	    exit 1;
	  fi
        fi
        sudo /opt/vyatta/sbin/vyatta-snmp.pl --update-snmp;
        if [ -n "$VAR(v3/)" ]
	  then
	    sudo /opt/vyatta/sbin/vyatta-snmp-v3.pl --update-snmp;
	  else
	    sudo invoke-rc.d snmpd start  > /dev/null 2>&1;
	fi
      fi