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

Problem with agent_unifi_controler #26

Open
tmp06276512 opened this issue Sep 4, 2024 · 2 comments
Open

Problem with agent_unifi_controler #26

tmp06276512 opened this issue Sep 4, 2024 · 2 comments

Comments

@tmp06276512
Copy link

Hi. I have been having a problem with the unifi_controller script for some time. In checkmk it returns an error. I think it's a problem with the new version of the api. We are using unifi controller version 8.3.2 Please help me with this error

image

@FlorianHeigl
Copy link

FlorianHeigl commented Nov 29, 2024

Hi, getting the same since today.

AttributeError: 'unifi_network_ssid' object has no attribute 'tcp_packet_loss'CRIT, Got no information from hostCRIT, execution time 4.9 sec

Obviously an API bug we end up needing to work around.
I think it's because I added one WiFi network which hasn't been used yet. it's not ideal that this breaks the whole special agent. check if you got that same scenario. I'm gonna try to hit it with a brick soon (fixing it, too).

@FlorianHeigl
Copy link

FlorianHeigl commented Nov 29, 2024

So turns out I'm just too tired to really fix this.

you got this code in ~/local/share/check_mk/agents/special/agent_unifi_controller

zooming in onto the problem

        for _k,_v in getattr(self,"reasons_bar_chart_now",{}).items():
            setattr(self,_k,_v)
        setattr(self,f"{self.radio}_num_sta",self.num_sta)
        setattr(self,f"{self.radio}_tcp_packet_loss",self.tcp_packet_loss)
        setattr(self,f"{self.radio}_wifi_retries",self.wifi_retries)
        setattr(self,f"{self.radio}_wifi_latency",self.wifi_latency)
        setattr(self,f"{self.radio}_avg_client_signal",self.avg_client_signal)

It tries to enrich the wifi quality info but doesn't handle the case if it doesn't actually have any (when self.tcp_packet_loss is not a key etc.. It has an _unwanted list further down, and it should be changed to also process a _wanted list that is compared to what is actually existing in .self. or you just braindeadly make it so the setattr fails better.

If you would rather not have that - partially missing - info break things change it to this.

########################################
######
######      S S I D
######
########################################
class unifi_network_ssid(unifi_object):
    def _init(self):
        self._UNIFICONTROLLER._UNIFI_SSIDS.append(self)
        self._UNIFI_SITE = self._PARENT._PARENT
        for _k,_v in getattr(self,"reasons_bar_chart_now",{}).items():
            setattr(self,_k,_v)
        setattr(self,f"{self.radio}_num_sta",self.num_sta)
        #setattr(self,f"{self.radio}_tcp_packet_loss",self.tcp_packet_loss)
        #setattr(self,f"{self.radio}_wifi_retries",self.wifi_retries)
        #setattr(self,f"{self.radio}_wifi_latency",self.wifi_latency)
        #setattr(self,f"{self.radio}_avg_client_signal",self.avg_client_signal)

I suppose it will also be solved by fixing the API isssue, attaching a WiFi client to the WiFi network for a while. I'll try to get around to testing that, but it should be clear that that is not fixing the issue.
Finally, one could sit down and look at the API returned data and report the issue to Ubiquiti. That might be smartest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants