aten_pdu: Get PDU location from LDAP
This commit is contained in:
parent
190a377076
commit
c820614f44
1 changed files with 15 additions and 4 deletions
|
@ -36,11 +36,22 @@ for state in /run/keepalived/*.state ; do
|
|||
break
|
||||
done
|
||||
|
||||
ldapsearch -Q -LLL "(&(objectClass=device)(description=Aten PE*))" cn | \
|
||||
awk '{ if ($1 == "cn:") print $2 }' | while read -r name
|
||||
ldapsearch -Q -LLL "(&(objectClass=device)(description=Aten PE*))" cn l | awk '
|
||||
{
|
||||
if ($1 == "cn:") {
|
||||
cn = $2
|
||||
}
|
||||
if ($1 == "l:") {
|
||||
l = substr($0, 3)
|
||||
}
|
||||
if ($0 == "" && cn != "" && l != "") {
|
||||
print cn l
|
||||
cn = ""
|
||||
l = ""
|
||||
}
|
||||
}
|
||||
' | while read -r name location
|
||||
do
|
||||
location="$(snmp_get "$name" RFC1213-MIB::sysLocation.0 | \
|
||||
tr '[:upper:]' '[:lower:]' | tr ' ' '_')"
|
||||
snmpwalk -v 1 -c "$community" "$name" -Oq \
|
||||
-m ATEN-PE-CFG ATEN-PE-CFG::outletName | while read -r port device
|
||||
do
|
||||
|
|
Loading…
Add table
Reference in a new issue