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
|
break
|
||||||
done
|
done
|
||||||
|
|
||||||
ldapsearch -Q -LLL "(&(objectClass=device)(description=Aten PE*))" cn | \
|
ldapsearch -Q -LLL "(&(objectClass=device)(description=Aten PE*))" cn l | awk '
|
||||||
awk '{ if ($1 == "cn:") print $2 }' | while read -r name
|
{
|
||||||
|
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
|
do
|
||||||
location="$(snmp_get "$name" RFC1213-MIB::sysLocation.0 | \
|
|
||||||
tr '[:upper:]' '[:lower:]' | tr ' ' '_')"
|
|
||||||
snmpwalk -v 1 -c "$community" "$name" -Oq \
|
snmpwalk -v 1 -c "$community" "$name" -Oq \
|
||||||
-m ATEN-PE-CFG ATEN-PE-CFG::outletName | while read -r port device
|
-m ATEN-PE-CFG ATEN-PE-CFG::outletName | while read -r port device
|
||||||
do
|
do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue