patricegautier/unifiZabbix

mcaDumpTimeout

andymarden opened this issue · 5 comments

Trying this out with an AC-lite.

I get the following error repeatedly in /tmp/mcaDumpShort.err:

Sat 11 Nov 08:01:29 UTC 2023 192.168.11.100
{ "at":"08:01:29", "r":"timeout (127)", "device":"192.168.11.100", "mcaDumpTimeout":"Error" }\n

I increased {$UNIFI_CHECK_TIMEOUT} to 30 but same issue.

I am using {$UNIFI_SSHPASS_PASSWORD_PATH}

Looking at this ecript, I need to have sshpass installed:

apt install sshpass

needs to be added to instructions (unless I missed it) and the error should be better since it doesn't timeout, it doesn't even connect.

Now I get:

Sat 11 Nov 08:13:30 UTC 2023 192.168.11.100
{ "at":"08:13:30", "r":"Remote pb: admin@192.168.11.100: Permission denied (publickey,password).", "device":"192.168.11.100", "mcaDumpError":"Error" }\n

OK - found the problem - the ssh call looks like this:

${SSHPASS_OPTIONS} ssh ${SSH_PORT} ${VERBOSE_SSH} ${HE_RSA_SSH_KEY_OPTIONS} ${BATCH_MODE} -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new ${PRIVKEY_OPTION} "${USER}@${TARGET_DEVICE}" "$command"

When I removed ${BATCH_MODE} from this - everything works fine.

Not sure why but at least for me this is what happens in ssh password mode (having to use that because the current unifi controller seems to be broken and won't allow a ssh key to be set - have raised with Unifi support.

Not doing a pull request because I dolt understand the wider implications of people running in key mode but someone who knows more can fix it. In the meantime, I am running with the locally-modified script.

So what kind of controller and firmware version are you hitting? what kind of device is 192.168.11.100? I don't use the password option myself so there certainly could be issues with that path..

leodej commented

i have the same error with my switch USW 48 PoE

when i use this command:

sudo -u zabbix /usr/lib/zabbix/externalscripts/mca-dump-short.sh -d 10.7.0.8 -u api -i /etc/sshkey/ -t SWITCH -p /etc/sshkey/senha.txt -v

i received this response:

{ "at":"00:22:54", "r":"timeout (127)", "device":"10.7.0.8", "mcaDumpTimeout":"Error" }

leodej commented

OK - found the problem - the ssh call looks like this:

${SSHPASS_OPTIONS} ssh ${SSH_PORT} ${VERBOSE_SSH} ${HE_RSA_SSH_KEY_OPTIONS} ${BATCH_MODE} -o ConnectTimeout=5 -o StrictHostKeyChecking=accept-new ${PRIVKEY_OPTION} "${USER}@${TARGET_DEVICE}" "$command"

When I removed ${BATCH_MODE} from this - everything works fine.

Not sure why but at least for me this is what happens in ssh password mode (having to use that because the current unifi controller seems to be broken and won't allow a ssh key to be set - have raised with Unifi support.

Not doing a pull request because I dolt understand the wider implications of people running in key mode but someone who knows more can fix it. In the meantime, I am running with the locally-modified script.

I try this, but its not working with me