Closed RainCaster closed 2 years ago
I found the source of the problem- some switches do not have telnet so the send/expect part of the script fails. It appears that these can be accessed by cli, so I will play with it a while.
I fixed the offending piece of code- here's a copy. Please review and add to your source as you see fit.
-re ".*\r\n" { send -- "telnet 127.0.0.1\r" expect { "(UBNT) >" { send -- "enable\r" expect "(UBNT) #" send -- "terminal length 0\r" expect "(UBNT) #" send -- "show run\r" log_file -noappend ${logFile}; expect "(UBNT) #" send -- "exit\r" log_file; expect "(UBNT) >" send -- "exit\r" expect ".*#" send -- "exit\r" expect eof } "telnet: not found\r\n" { send -- "cli\r" expect -re ".*#" send -- "terminal length 0\r" expect -re ".*#" send -- "show run\r" log_file -noappend ${logFile}; expect -re ".*#" send "exit\r" log_file; expect -re ".*>" send -- "exit\r" expect -re ".*#" send -- "exit\r" expect eof } }
Ok thanks - let me investigate. What kind of a switch is it?
Edit: Never mind I see the answer above, the one timing out is a 'USW-16-PoE'
Ok included this fix in the latest commit. Thanks!
I have 5 switches, 4 of which are 4 or 8 port. Those 4/8-port switches work as I expect them to. One is a 16 port (USW-16-PoE) and it never replies correctly in zabbix. In zabbix, the error is "timeout while executing a shell script"
When I run the same params by hand with mca-dump-short.sh, I get nothing back from it, but a return code of 2. Using a -v gives me nothing useful, just the command line passed off by the script.
When I run that same command line as reported, it succeeds every time. Takes about 1.8 sec to complete
The size of the file I get back from the raw command line is 22k in size, if that matters.