|
@@ -99,6 +99,60 @@ snmpd_access_add() {
|
99
|
99
|
echo "access $group $context $version $level $prefix $read $write $notify" >> $CONFIGFILE
|
100
|
100
|
}
|
101
|
101
|
|
|
102
|
+snmpd_trap_hostname_add() {
|
|
103
|
+ local cfg="$1"
|
|
104
|
+ config_get hostname "$cfg" HostName
|
|
105
|
+ config_get port "$cfg" Port
|
|
106
|
+ config_get community "$cfg" Community
|
|
107
|
+ config_get type "$cfg" Type
|
|
108
|
+ echo "$type $hostname $community $port" >> $CONFIGFILE
|
|
109
|
+}
|
|
110
|
+
|
|
111
|
+snmpd_trap_ip_add() {
|
|
112
|
+ local cfg="$1"
|
|
113
|
+ config_get host_ip "$cfg" HostIP
|
|
114
|
+ config_get port "$cfg" Port
|
|
115
|
+ config_get community "$cfg" Community
|
|
116
|
+ config_get type "$cfg" Type
|
|
117
|
+ echo "$type $host_ip $community $port" >> $CONFIGFILE
|
|
118
|
+}
|
|
119
|
+
|
|
120
|
+snmpd_access_default_add() {
|
|
121
|
+ local cfg="$1"
|
|
122
|
+ config_get mode "$cfg" Mode
|
|
123
|
+ config_get community "$cfg" CommunityName
|
|
124
|
+ config_get oidrestrict "$cfg" RestrictOID
|
|
125
|
+ config_get oid "$cfg" RestrictedOID
|
|
126
|
+ echo -n "$mode $community default" >> $CONFIGFILE
|
|
127
|
+ [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE
|
|
128
|
+ [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE
|
|
129
|
+}
|
|
130
|
+
|
|
131
|
+snmpd_access_HostName_add() {
|
|
132
|
+ local cfg="$1"
|
|
133
|
+ config_get hostname "$cfg" HostName
|
|
134
|
+ config_get mode "$cfg" Mode
|
|
135
|
+ config_get community "$cfg" CommunityName
|
|
136
|
+ config_get oidrestrict "$cfg" RestrictOID
|
|
137
|
+ config_get oid "$cfg" RestrictedOID
|
|
138
|
+ echo -n "$mode $community $hostname" >> $CONFIGFILE
|
|
139
|
+ [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE
|
|
140
|
+ [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE
|
|
141
|
+}
|
|
142
|
+
|
|
143
|
+snmpd_access_HostIP_add() {
|
|
144
|
+ local cfg="$1"
|
|
145
|
+ config_get host_ip "$cfg" HostIP
|
|
146
|
+ config_get ip_mask "$cfg" IPMask
|
|
147
|
+ config_get mode "$cfg" Mode
|
|
148
|
+ config_get community "$cfg" CommunityName
|
|
149
|
+ config_get oidrestrict "$cfg" RestrictOID
|
|
150
|
+ config_get oid "$cfg" RestrictedOID
|
|
151
|
+ echo -n "$mode $community $host_ip/$ip_mask" >> $CONFIGFILE
|
|
152
|
+ [ "$oidrestrict" == "yes" ] && echo " $oid" >> $CONFIGFILE
|
|
153
|
+ [ "$oidrestrict" == "no" ] && echo "" >> $CONFIGFILE
|
|
154
|
+}
|
|
155
|
+
|
102
|
156
|
snmpd_pass_add() {
|
103
|
157
|
local cfg="$1"
|
104
|
158
|
local pass='pass'
|
|
@@ -151,6 +205,11 @@ start_service() {
|
151
|
205
|
config_foreach snmpd_group_add group
|
152
|
206
|
config_foreach snmpd_view_add view
|
153
|
207
|
config_foreach snmpd_access_add access
|
|
208
|
+ config_foreach snmpd_trap_hostname_add trap_HostName
|
|
209
|
+ config_foreach snmpd_trap_ip_add trap_HostIP
|
|
210
|
+ config_foreach snmpd_access_default_add access_default
|
|
211
|
+ config_foreach snmpd_access_HostName_add access_HostName
|
|
212
|
+ config_foreach snmpd_access_HostIP_add access_HostIP
|
154
|
213
|
config_foreach snmpd_pass_add pass
|
155
|
214
|
config_foreach snmpd_exec_add exec
|
156
|
215
|
config_foreach snmpd_disk_add disk
|