(^^^ kinda what i'm trying to do, but the variable i need isn't in SW database as the device IP, the variable is in the device config)
I've tried searching and I'm coming up short. Put the word "syslog" into a search and all you get back is Kiwi posts which makes it hard to find related topics.
I have need to update all devices syslog servers. The issue i have is not all devices can be configured with the same commands. It differs based on design.
Some devices are managed/monitored by loopback. Others by dedicated MGT port that is configured in a VRF. The commands differ for each.
##################################################
Device managed/monitored by loopback would get command:
logging host X.X.X.X
##################################################
Device managed/monitored by VRF would get command:
logging host X.X.X.X vrf *NAME-OF-VRF
##################################################
Now the even harder part. Different devices have different standard VRF names by default.
The different VRF names:
managment
Mgmt-intf
mgmtVrf
Mgmt-vrf
So what i need. I need a way for SW to configure a device based on another field in the device config. When built the device is manually configured with source interface command. Looking at this line tells me exactly how to configure the syslog statements. I need SW to do the same thing.
Manual WP:
SSH to device
run command "sh run | inc logging source-interface"
configure based on output
##################################################
example:
SWITCH1# sh run | inc logging source-interface
SWITCH1# logging source-interface Loopback0
SWITCH1#
SWITCH1# conf t
SWITCH1# logging host X.X.X.X
##################################################
example:
SWITCH2# sh run | inc logging source-interface
SWITCH2# logging source-interface GigabitEthernet0/0 vrf Mgmt-vrf
SWITCH2#
SWITCH2# conf t
SWITCH2# logging host X.X.X.X vrf Mgmt-vrf
##################################################
So Solarwinds would need to do the same. It needs to either configure based on the output like a person would OR use config backup to determine logging source to configure. Either way would work.
##################################################
Solarwinds Logic:
#execute command on devices(or check config backup for host):
SWITCH1# sh run | inc logging source-interface
logging source-interface Loopback0
SWITCH2# sh run | inc logging source-interface
logging source-interface GigabitEthernet0/0 vrf Mgmt-vrf
#Then depending on return execute scripts
#no VRF found
IF "Loopback0" is returned in the line
#execute the line:
logging host X.X.X.X
#VRF found
IF "vrf" is returned in the line
then @VARIABLE gets set from output from switch after word "vrf"
@VARIABLE = "Mgmt-vrf"
#execute the line:
logging host X.X.X.X vrf @VARIABLE