Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] error while get_traffic : unknown #42

Closed
fezo76 opened this issue May 11, 2020 · 50 comments
Closed

[Bug] error while get_traffic : unknown #42

fezo76 opened this issue May 11, 2020 · 50 comments
Assignees
Labels
bug Something isn't working testing Solution is being tested

Comments

@fezo76
Copy link

fezo76 commented May 11, 2020

Hi!
unfortunately, mikrotik integration always freezes
https://ibb.co/3Y1BmzB
sometimes it goes for 12 hours, sometimes only for a few hours
in which case I get an identities unavailable message
https://ibb.co/DCQRFZV
I have 2 such routers at home. each gives such a message
if i delete the integration then add it again and configure it will go (hours)
as if the mikrotik would ban it after a while.
there are no firewall rules set in the router !!
SW
Mikrotik router 1.5.6
Home Assistant 0.109.6
Mikrotik HapAC2 os ver. 6.46.5

Thank you!

@fezo76 fezo76 added the bug Something isn't working label May 11, 2020
@tomaae
Copy link
Owner

tomaae commented May 11, 2020

Do not remove issue templates, I need information as stated in them.
Specially I need logs from HA, its much clearer there. What is happening in log screenshot is not normal, looks like reconnect attempts, but I cannot be sure without HA logs.

@tomaae tomaae added the more info needed Need more information label May 11, 2020
@fezo76
Copy link
Author

fezo76 commented May 11, 2020

"Do not remove issue templates, I need information as stated in them."
Sorry :(

2020-05-11 08:40:15 WARNING (SyncWorker_19) [custom_components.mikrotik_router.mikrotikapi] Mikrotik Reconnected to 192.168.88.10
2020-05-11 08:40:15 ERROR (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.88.10 error while get_traffic : unknown

https://ibb.co/7J55wd4

@tomaae
Copy link
Owner

tomaae commented May 11, 2020

strange to get an api error there. can you debug it?

@fezo76
Copy link
Author

fezo76 commented May 11, 2020

how to?

@ivanpavlina
Copy link
Contributor

add this to your configuration.yaml to get debug logs for this integration, restart homeassistant and paste the logs again when it breaks..

logger:
  default: info
  logs:
    custom_components.mikrotik_router: debug

@fezo76
Copy link
Author

fezo76 commented May 11, 2020

2020-05-11 17:11:42 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] API query: /interface
2020-05-11 17:11:42 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] API query: /interface/monitor-traffic
2020-05-11 17:11:42 ERROR (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.xxx.xxx.1 error while get_traffic : unknown

@tomaae
Copy link
Owner

tomaae commented May 11, 2020

I will need full log from custom_components.mikrotik_router which captures whole event, not just last few messages.
Nothing after interface query looks really weird. It should be 5 port switch with 2 wifi interfaces.

@fezo76
Copy link
Author

fezo76 commented May 11, 2020

I copied from this , home-assistant.log
do I need the full file?

Copy link
Owner

tomaae commented May 11, 2020

yes, home-assistant.log. but just entries from custom_components.mikrotik_router are fine, I dont need data from other components

@tomaae tomaae changed the title [Bug] [Bug] error while get_traffic : unknown May 13, 2020
@fezo76
Copy link
Author

fezo76 commented May 14, 2020

Hi!
approx. these are repeated
and mikrotik log 1000x
user xxx logged in from 192.xxx.xxx.1 via api
2-5 sec, user xxx logged out from 192.xxx.xxx.1 via api
repeated
repeated..

2020-05-14 17:02:34 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/dhcp-server/lease
2020-05-14 17:02:34 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:34 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping

2020-05-14 17:02:34 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] API query: /ping

2020-05-14 17:02:34 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping

2020-05-14 17:02:34 DEBUG (SyncWorker_14) [custom_components.mikrotik_router.mikrotikapi] API query: /interface
2020-05-14 17:02:34 DEBUG (SyncWorker_14) [custom_components.mikrotik_router.mikrotikapi] API query: /interface/monitor-traffic
2020-05-14 17:02:34 ERROR (SyncWorker_14) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.88.1 error while get_traffic : unknown

2020-05-14 17:02:34 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:34 DEBUG (SyncWorker_4) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:35 DEBUG (SyncWorker_16) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:35 DEBUG (SyncWorker_16) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:35 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:35 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:35 DEBUG (SyncWorker_11) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:35 DEBUG (SyncWorker_11) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_6) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_6) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_14) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:36 DEBUG (SyncWorker_14) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:37 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:37 DEBUG (SyncWorker_2) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:37 DEBUG (SyncWorker_10) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:37 DEBUG (SyncWorker_10) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:37 DEBUG (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:37 DEBUG (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:38 DEBUG (SyncWorker_11) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:38 DEBUG (SyncWorker_11) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping

2020-05-14 17:02:39 DEBUG (SyncWorker_1) [custom_components.mikrotik_router.mikrotikapi] API query: /interface/wireless/registration-table
2020-05-14 17:02:39 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] API query: /interface/bridge/host

2020-05-14 17:02:41 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.mikrotikapi] API query: /interface
2020-05-14 17:02:41 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.mikrotikapi] API query: /interface/monitor-traffic
2020-05-14 17:02:41 ERROR (SyncWorker_3) [custom_components.mikrotik_router.mikrotikapi] Mikrotik 192.168.88.1 error while get_traffic : unknown

2020-05-14 17:02:45 WARNING (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] Mikrotik Reconnected to 192.168.88.1
2020-05-14 17:02:45 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] API query: /interface

2020-05-14 17:02:45 DEBUG (SyncWorker_12) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/arp
2020-05-14 17:02:46 DEBUG (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:46 DEBUG (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping

2020-05-14 17:02:47 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:47 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:47 DEBUG (SyncWorker_11) [custom_components.mikrotik_router.mikrotikapi] API query: /ip/dhcp-server/lease
2020-05-14 17:02:47 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:47 DEBUG (SyncWorker_0) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:47 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:47 DEBUG (SyncWorker_8) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping

2020-05-14 17:02:49 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:49 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:49 DEBUG (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:49 DEBUG (SyncWorker_15) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_3) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_17) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_12) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_12) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_19) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:50 DEBUG (SyncWorker_19) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:51 DEBUG (SyncWorker_6) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:51 DEBUG (SyncWorker_6) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:51 WARNING (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] Mikrotik Reconnected to 192.168.88.1
2020-05-14 17:02:51 DEBUG (SyncWorker_7) [custom_components.mikrotik_router.mikrotikapi] API query: /interface
2020-05-14 17:02:51 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:51 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping
2020-05-14 17:02:52 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] API query: /ping
2020-05-14 17:02:52 DEBUG (SyncWorker_5) [custom_components.mikrotik_router.mikrotikapi] Ping host query: /ping

@tomaae
Copy link
Owner

tomaae commented May 14, 2020

if that is all you are getting, it means your router api is not returning anything. I dont know how is that possible since login was successful. You better check your firewall rules in case you are blocking outgoing traffic from API or user you use does not have rights to access api other then login.

@fezo76
Copy link
Author

fezo76 commented May 19, 2020

I tested it for several days! I turned off all rules. unfortunately no good
or if I turn this off then there may be no error
add action=drop chain=input comment="invalid drop" connection-state=
invalid disabled=yes

Copy link
Owner

tomaae commented May 19, 2020

It is weird. you said it was working for a while, but in debugs you have provided, there was nothing at all, so it was not working.
maybe try it few more time with debug enabled. you can try removing and re-adding integration with debug enabled. Maybe you will be able to catch some lead.

@fezo76
Copy link
Author

fezo76 commented May 20, 2020

Hi!
well i configured a brand new microtik router (hassio)
unfortunately the same. Here is the mistake
I did not set any firewall rules

Yes. interesting because i can't determine how long it's good. 1 hour, 5 hours variable

@tomaae
Copy link
Owner

tomaae commented May 20, 2020

can you capture it in debug? the moment then it stops working, so we can still see data coming in and then stop?
I know it may be a large debug, but I dont see any other option here.

@ivanpavlina
Copy link
Contributor

I got the same issue, it broke few minutes after startup

Mikrotik 192.168.88.1 error while get_traffic : unknown
Mikrotik Reconnected to 192.168.88.1
...

It just loops those logs

I'll look into it,.

@fezo76
Copy link
Author

fezo76 commented May 26, 2020

Hi!
what I experienced.
I run more scipt. there is what every 30 minutes and there is more which is evening and morning.
If this happens you can freeze the microtik HA module.
I have currently turned off all automatic scitpts.
So far, so good

update:
if multiple scripts are running at once, I see the error

@tomaae
Copy link
Owner

tomaae commented Jun 7, 2020

Hi!
what I experienced.
I run more scipt. there is what every 30 minutes and there is more which is evening and morning.
If this happens you can freeze the microtik HA module.
I have currently turned off all automatic scitpts.
So far, so good

update:
if multiple scripts are running at once, I see the error

I have missed this. how do you run those scripts at the same time? any detailed info that would help me reproduce this issue would help.

@fezo76
Copy link
Author

fezo76 commented Jun 7, 2020

can you add an old version?
"when we talked about the format in which RX, TX (KByte, KBit, etc.) appears"
I didn't have such a mistake then

@fezo76
Copy link
Author

fezo76 commented Jun 7, 2020

i made a new installation.
then I only installed the HACS and MIKROTIK ROUTER module.
Then I turned off one of the wifi interfaces in WINBOX software.
After 3 seconds, the module is unavailable
HassOS 4.8 , RouterOS 6.47 , RouterBOARD D52G-5HacD2HnD-TC

Copy link
Owner

tomaae commented Jun 8, 2020

I didnt delete any versions, you can try old version at any time.

Without running any scripts?
If you dont turn off the interface, will it work? Also, was it physical or virtual interface?

@fezo76
Copy link
Author

fezo76 commented Jun 8, 2020

Hi! Anything I modify the mikrotik interface, the module crashes. The physical is true, but I will also look at the virtual.
The freeze was even when I set the capsman manager switch.

Copy link
Owner

tomaae commented Jun 8, 2020

I tried disabling and enabling various interfaces, but everything works fine for me. I even updated to the same RouterOS version you have.

Copy link
Owner

tomaae commented Jun 10, 2020

Can you export your whole mikrotik configuration and give me detailed step by step instructions how to reproduce the issue?
Remember to remove any passwords or sensitive data from configuration export.

@fezo76
Copy link
Author

fezo76 commented Jun 10, 2020

Hi!
I spent a lot of time testing.
homeassistant-mikrotik_router-1.5.2_OK.zip (this works well)
Modules above 1.5.2 are already faulty for me.

Copy link
Owner

tomaae commented Jun 10, 2020

There were quite few changes between those versions.
I will need to copy your setup so I can try to reproduce it. This is probably some specific configuration you have.

@Vards0
Copy link

Vards0 commented Jun 16, 2020

Hi.

I'm also getting this issue. The Mikrotik works okay for a short period of time then stops responding.

Log Details (ERROR)
Logger: custom_components.mikrotik_router.mikrotikapi
Source: custom_components/mikrotik_router/mikrotikapi.py:418
Integration: Mikrotik Router (documentation)
First occurred: 1:04:56 PM (309 occurrences)
Last logged: 2:01:42 PM

Mikrotik x.x.x.x error while get_traffic : unknown

image

Happy to provide log files if it helps.

Copy link
Owner

tomaae commented Jun 16, 2020

please do, also export of your setup. just mask any private information.

@bartek75
Copy link

i have experianced the same issue just recently. and i think is related to upgraded version of module. current version on my installation is 1.5.8.

Copy link
Owner

tomaae commented Jun 22, 2020

there is nothing I can do unless I receive information I need for reproducing the issue from someone.

@bartek75
Copy link

bartek75 commented Jun 23, 2020 via email

@tomaae
Copy link
Owner

tomaae commented Jun 23, 2020

I will need a configuration export to see what kind of special setup is causing this.

@bartek75
Copy link

here is my config
mybackup.cfg.txt

@tomaae
Copy link
Owner

tomaae commented Jun 26, 2020

I kept your configuration running for quite a while and problem was not reproduced.
Can you try to debug it so we know exact error you get?

@bartek75
Copy link

bartek75 commented Jun 26, 2020 via email

Copy link
Owner

tomaae commented Jun 26, 2020

thats even more strange

@bartek75
Copy link

ok, so i got it broken again, it looks like it breaks when i connect through vpn.

@bartek75
Copy link

i connected to vpn around 20:09 and disconnected a minute later. After connecting to vpn i run homeassistant application on my mobile. seen me as home, and other persons as away. I turned off one device, closed application and disconnected from vpn.
I got home few minutes later. Run application and noticed other persons as unknown. So i looked up the mikrotik status, and all entities where unknown. Logs in app saying:
Logger: custom_components.mikrotik_router.mikrotikapi
Source: custom_components/mikrotik_router/mikrotikapi.py:418
Integration: Mikrotik Router (documentation)
First occurred: 8:10:52 PM (91 occurrences)
Last logged: 8:57:16 PM
Mikrotik 192.168.2.254 error while get_traffic : unknown
and
Logger: custom_components.mikrotik_router.mikrotikapi
Source: custom_components/mikrotik_router/mikrotikapi.py:207
Integration: Mikrotik Router (documentation)
First occurred: 8:11:23 PM (90 occurrences)
Last logged: 8:57:16 PM
Mikrotik Reconnected to 192.168.2.254
Attached is log, be advised time in log is offset by -6 hours, so it was around 14:09 in log. The log is cut as it was big. If needed i have a copy of full log.
homeassistant_greped.log

@bartek75
Copy link

bartek75 commented Jun 26, 2020

restarting homeassistant fixes the problem. Connecting and disconnecting vpn breaks it again. It is actually the disconnecting which breaks the component.

@tomaae
Copy link
Owner

tomaae commented Jun 26, 2020

thanks, I can see whats happening in debugs now.

@tomaae
Copy link
Owner

tomaae commented Jun 26, 2020

can you test the same with master branch?

@tomaae tomaae self-assigned this Jun 26, 2020
@tomaae tomaae added testing Solution is being tested and removed more info needed Need more information labels Jun 26, 2020
@bartek75
Copy link

it looks like it still does not work. Or maybe i do not know how to use master. I downloaded homeassistant-mikrotik_router-master.zip, decompressed it and copied content of mikrotik_router to my homeassistant/custom_components/mikrotik_router. I noticed two files with different length. Full log attached.
home-assistant.log
How to confirm if the component is in the master version?

@tomaae
Copy link
Owner

tomaae commented Jun 27, 2020

Yeah, its not as clear with new HACS UI. This is how you switch to master:
image
Downloading it manually works too, as long as you copied it correctly.

I have added debugs to get more information for this particular issue, please replace helper.py with this file and run debug again:
helper.zip

@bartek75
Copy link

new logs with new helper
home-assistant.log

@tomaae
Copy link
Owner

tomaae commented Jun 27, 2020

thanks, of course I excluded every type of ppp user except one you use. a copy paste woopsie :)
try master again, should be fine now.

@bartek75
Copy link

bartek75 commented Jun 27, 2020

success. it works now.

@tomaae
Copy link
Owner

tomaae commented Jun 27, 2020

No, it wont break. Each ppp connection creates a new interface of type relevant to that connection:

[
  {
    ".id": "*F0000E",
    "name": "\u003covpn-user\u003e",
    "type": "ovpn-in",
    "mtu": 1500,
    "actual-mtu": 1500,
    "last-link-up-time": "jun/27/2020 09:01:33",
    "link-downs": 0,
    "rx-byte": 5599,
    "tx-byte": 21670,
    "rx-packet": 46,
    "tx-packet": 82,
    "rx-drop": 0,
    "tx-drop": 0,
    "tx-queue-drop": 0,
    "rx-error": 0,
    "tx-error": 0,
    "fp-rx-byte": 0,
    "fp-tx-byte": 0,
    "fp-rx-packet": 0,
    "fp-tx-packet": 0,
    "dynamic": true,
    "running": true,
    "disabled": false
  }
]

Here is a list of all types for each ppp:

                {"name": "type", "value": "ppp-in"},
                {"name": "type", "value": "pptp-in"},
                {"name": "type", "value": "sstp-in"},
                {"name": "type", "value": "l2tp-in"},
                {"name": "type", "value": "pppoe-in"},
                {"name": "type", "value": "ovpn-in"},

Problem was that when it disconnected, interface was removed and when integration sent a query for that interface, mikrotik returns an error.

Thanks a lot for helping with debugs, this issue was driving me nuts since I could not replicate it.

@bartek75
Copy link

great! happy it is resolved. Excellent job!

@tomaae
Copy link
Owner

tomaae commented Jun 27, 2020

fix released in v1.5.9

@tomaae tomaae closed this as completed Jul 5, 2020
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked and limited conversation to collaborators Dec 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working testing Solution is being tested
Projects
None yet
Development

No branches or pull requests

5 participants