Code Monkey home page Code Monkey logo

Comments (10)

reesealexander avatar reesealexander commented on September 22, 2024

I did some testing. i was wrong with "zabbix_api.py".
it is only used if you use "Monitoring type: Zabbix" in Server Setup.
with this it seems to work.

but we use "Monitoring type: ZabbixProblemBased", with this type of server setup the issue accure.
if understand the code correct this Monitoring Type did not use the definitions in zabbix_api.py. it use a own written light defintion to connect to the api.
and in this implementation i cannot find the fix for zabbix api need "username" from version 6.4 on, and not "user" parameter to logon.

in ZabbixProblemBased.py line 99 login methode is defined with
def login(self, username, password): self.logger.debug("Login in as " + username) self.zbx_auth = self.do_request('user.login', {'user': username, 'password':password}) `

it should cover zabbix version there, i guess.

from nagstamon.

reesealexander avatar reesealexander commented on September 22, 2024

ok, more informations.
with "Monitoring type: ZabbixProblemBased" using class ZabbixLightApi that didn´t cover zabbix version >=6.4 user usernamen and not user for logon parameter. i have tested it with this code change in "ZabbixProblemBased.py" :

`
def api_version(self, **options):
# kicked out check auth to be able to check vesion before being logged in to use the correct username keyword
obj = self.do_request('apiinfo.version', options, no_auth=True)
return obj #['result']

def login(self, username, password):
    self.logger.debug("Login in as " + username)
    # 21.03.2024 a.reese: add to cover zabbix api version login like zabbix_api.py
    # check version to use the correct keyword for username which changed since 6.4
    if self.api_version() < '6.4':        
        self.zbx_auth = self.do_request('user.login', {'user': username, 'password': password})
    else:
        self.zbx_auth = self.do_request('user.login', {'username': username, 'password': password})      

`

and with zabbix 6.4.12 it is working for me.
i have no zabbix lower than this, to test if it also work with the older version.
maybe someone can test and implement this change to the main and create a release with a fix.

from nagstamon.

robertortel avatar robertortel commented on September 22, 2024

I can support that request. I do now have the same issue with Nagstamon 3.14.0.

Side information:
Nagstmon 3.10.0 still worked very well with zabbix 6.4.2 for me for many months.
Nagstamon 3.12.0 had the same issues with this zabbix 6.4.2, so I kept using 3.10.0.
Nagstamon 3.14.0 has the same issue as 3.12.0.
With the update of zabbix to 6.4.12 Nagstamon 3.10.0 does no longer work as well.

from nagstamon.

HenriWahl avatar HenriWahl commented on September 22, 2024

@reesealexander thanks for your research. I applied your patch and it is available now in latest testing release. Can you please try if it works as expected?

from nagstamon.

reesealexander avatar reesealexander commented on September 22, 2024

Hi @HenriWahl,
if tried to test but the program crash after i have setup a server wit monitoring typ "zabbix server problem based".
i have checked your new code and i think you have miss the function definition for "api_version"

Sorry but github or i´m not able to give this code a god looking format in this comment window.

def api_version(self, **options): obj = self.do_request('apiinfo.version', options, no_auth=True) return obj #['result']
thx Alex

from nagstamon.

HenriWahl avatar HenriWahl commented on September 22, 2024

@reesealexander I added in into the latest testing release.

from nagstamon.

reesealexander avatar reesealexander commented on September 22, 2024

Hi @HenriWahl ,
sorry it is still not working. program just crash after setup a server with monitoring type "zabbix server problem based".

i have taken a look into the function "api_version()" you have implemented into the Nagstamon/Servers/ZabbixProblemBased.py
and it is a copy of the some funtions from Nagstamon/thirdparty/zabbix_api.py

during my code changes i have discovered that this is not working due to a problem with the returned object in obj, that not include an array it is juts a string. works for some kind of reason different in the ZabbixProblemBased.py than in zabbix_api.py.

that is why i have changed the funtion to just return the "obj" variable. as you see in my comments from 2 days ago.
the ['result'] part is now a comment starting with #.

;-)

from nagstamon.

HenriWahl avatar HenriWahl commented on September 22, 2024

Ah OK, I thought this comment was a mistake. 🤪

from nagstamon.

HenriWahl avatar HenriWahl commented on September 22, 2024

@reesealexander I rebuilt with your change - can you test the latest testing release? It has the same version number for the sake of faster deployment.

from nagstamon.

reesealexander avatar reesealexander commented on September 22, 2024

Hi @HenriWahl ,
now it is working like expected. but i can only test with zabbix version 6.4.12.
Maybe some other user can test with older versions of zabbix.

from nagstamon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.