Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-3517

NGINX agent-local script

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • None
    • Community Edition, Professional Edition
    • Unix Agent
    • Ubuntu 20.04 LTS with Python3

    Description

      The nginx script for linux system on Python3 (default on Ubuntu 20.04) returns several errors regarding the deprecation of some functions / libraries.

       

      On python3, urllib2 is not used in favor of urlib.request

      On python3, print "" is not used in favor of print()

       

      To fix this and allow compatibility, adding a "try" for the lib and change the fetch function could allow python2 and python3 requests.

       

       

      try:
       from urllib.request import urlopen < python3
      except ImportError:
       from urllib2 import urlopen < the fall back to python2
      

       

       

       When using urllib, because of the next part of the code, we need to add '.decode('utf8')'

      data = urlopen('http://localhost/nginx-status').read().decode('utf-8')
      

       

      Attachments

        Activity

          People

            sid3windr Tom Laermans
            tiagomreis Tiago Reis
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: