Update with new sequencer features
This commit is contained in:
20
seqs/snmp.sh
20
seqs/snmp.sh
@@ -15,8 +15,7 @@ step_1() {
|
||||
else
|
||||
exe apt install $toolName
|
||||
fi
|
||||
saveReturn $?
|
||||
endReturn
|
||||
endReturn -o $? "$toolName installation failed"
|
||||
}
|
||||
|
||||
step_2_info() { echo "Setup snmp v3 access"; }
|
||||
@@ -24,11 +23,10 @@ step_2() {
|
||||
#
|
||||
## Create authentication entry
|
||||
exep "cat \"$v3AuthLoc\" | grep -e '^\s*usmUser'"
|
||||
|
||||
if [ "$?" == "0" ]; then
|
||||
echo
|
||||
|
||||
read -p "User entry found. Continue: y/n(default)? " answer
|
||||
exe read -p "User entry found. Continue: y/n(default)? " answer
|
||||
case $answer in
|
||||
[yY])
|
||||
echo
|
||||
@@ -64,11 +62,13 @@ step_2() {
|
||||
|
||||
#
|
||||
## Write syslocation
|
||||
read -p "sysLocation: " v3Location
|
||||
read -p "sysContact (name <webmaster@example.com>): " v3Contact
|
||||
exe read -p "sysLocation: " v3Location
|
||||
exe read -p "sysContact (name <webmaster@example.com>): " v3Contact
|
||||
|
||||
exe sed -i "s/\(sysLocation\s*\).*/\1${v3Location}/" "$toolConfig"
|
||||
exe sed -i "s/\(sysContact\s*\).*/\1${v3Contact}/" "$toolConfig"
|
||||
|
||||
exe service snmpd start
|
||||
}
|
||||
v3AuthLoc="/var/lib/snmp/snmpd.conf"
|
||||
|
||||
@@ -81,8 +81,7 @@ step_20() {
|
||||
fi
|
||||
|
||||
exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/raspberry.sh -O "${rpiExtendLoc}"
|
||||
saveReturn $?
|
||||
endReturn
|
||||
endReturn -o $? "Download failed"
|
||||
exe chmod +x "$rpiExtendLoc"
|
||||
|
||||
addConf -a "extend raspberry /etc/snmp/raspberry.sh" "$toolConfig"
|
||||
@@ -93,7 +92,7 @@ step_20() {
|
||||
|
||||
rpiExtendLoc="${toolConfigLoc}/raspberry.sh"
|
||||
rpiSudoersLoc="/etc/sudoers.d/snmprpi"
|
||||
rpiSudoersContent="\
|
||||
rpiSudoersContent="
|
||||
Debian-snmp ALL=(ALL) NOPASSWD: /etc/snmp/raspberry.sh, /usr/bin/vcgencmd*"
|
||||
|
||||
step_22_info() { echo "Extend $toolName with OS update availablity"; }
|
||||
@@ -105,6 +104,7 @@ step_22() {
|
||||
fi
|
||||
|
||||
exe wget https://raw.githubusercontent.com/librenms/librenms-agent/master/snmp/osupdate -O "${osUpdateExtendLoc}"
|
||||
endReturn -o $? "Download failed"
|
||||
exe chmod +x "$osUpdateExtendLoc"
|
||||
addConf -a "extend osupdate $osUpdateExtendLoc" "$toolConfig"
|
||||
|
||||
@@ -142,5 +142,5 @@ checkExtend() {
|
||||
return 0
|
||||
}
|
||||
|
||||
VERSION_SEQREV=5
|
||||
VERSION_SEQREV=7
|
||||
. sequencer.sh
|
||||
|
Reference in New Issue
Block a user