cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
525
Views
1
Helpful
4
Replies

How to get c9800 mdns-sd cache remotely?

Hi,

I'm trying to survey the presence of a given entry in the c9800 wireless controller mdns cache. SNMP does not seem to forward this kind of information, neither does netconf. The last idea was to ssh the command, but bash scripts work when executed manually, but don't receive any reply from within a cron task (prabably because there is no terminal attached). Until now, suggestions from google search did not help...

4 Replies 4

After a lot of debugging, I found that the ssh issue from cron, not returning any result, can be observed only with "show mdns-sd cache" command. Instead, using "show mdns-sd" returns 'Line has invalid autocommand "show mdns-sd" ' and "show mdns-sd query-db" returns some text, but not really what I'm looking for... . Looks like the "cache" word triggers some particular treatment on the c9800 side...

Rich R
VIP
VIP

What script were you running from cron?

Did you remember to issue "term len 0" before the show command?

Well, even the term command did not do the trick, changing the way of sending the command (almost) allowed me to get the text I wanted. Indeed,   

 

ssh -l myuser mywlc 'show mdns-sd cache' does not work, but

 

ssh -l myuser mywlc <<EOT | grep -v "mywlc"

show mdns-sd cache

EOT

 

did it... Probably the command is not considered to be an autocommand anymore...

Note that the last grep -v is needed in order to suppress remote prompt and the echoed command from the final result...

 

Yes I would not expect that to work well.  You'd either have to write it as an expect or python script or use some other custom scripting tool designed to work which allows this type of interactive result from network devices.
https://www.geeksforgeeks.org/expect-command-in-linux-with-examples/
https://www.digitalocean.com/community/tutorials/expect-script-ssh-example-tutorial
https://phoenixnap.com/kb/linux-expect

https://developer.cisco.com/codeexchange/github/repo/CiscoDevNet/python_code_samples_network/

 

 

Review Cisco Networking for a $25 gift card