Как запустить Nagstamon 3.0.2 на CentOS 7?

Аватар пользователя admin

Тем, кто установил Icinga2 или Zabbix 4 необходима версия Nagstamon 3, иначе работать не будет. Но в дистрибутиве CentOS 7 такой версии нет, только 1.0.x. Пакет nagstamon 3.0.2 существует только для Fedora 25 и Fedora 26, но на CentOS 7 ожидаемо не ставится, ругаясь на зависимости. Что же делать? У меня сработал вот такой способ.

  1. Скачиваете с официального сайта Nagstamon (https://nagstamon.ifw-dresden.de/files/stable/)  пакет для Fedora 25. (Потому что он использует Python-3.5). На момент написания данной статьи это nagstamon-3.0.2.fedora25-1.noarch.rpm.
  2. Подключаете репозиторий IUS для CentOS 7: https://ius.io/GettingStarted/
  3. Выполняете yum makecache, а затем yum install python35u-devel python35u-libs python35u-lxml python35u python35u-setuptools python35u-pip.
  4. Устанавливаете пакет nagstamon-3.0.2.fedora25-1.noarch.rpm, командой rpm -i nagstamon-3.0.2.fedora25-1.noarch.rpm --nodeps, т.е. игнорируя зависимости. Если вы не добавите --nodeps, то получите ругать на недостающие пакеты:

    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-SecretStorage
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-beautifulsoup4
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-crypto
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-cryptography
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-keyring
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-lxml
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-psutil
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-qt5
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-requests
    nagstamon-3.0.1.fedora25-1.noarch требует недостающего python3-requests-kerberos
  5. Делаем симлинк с python3.5 на python3 командой: ln -sf /bin/python3.5 /bin/python3, чтобы в качестве 3-й версии у нас использовался python3.5.
  6. Теперь доставляем необходимые для работы зависимости, используя команду pip35 от python 3.5. Привожу список выполненных команд и что мне написало в процессе установки:

    # pip3.5 install keyring
    Collecting keyring
      Downloading keyring-11.0.0-py2.py3-none-any.whl
    Collecting secretstorage; sys_platform == "linux2" or sys_platform == "linux" (from keyring)
      Using cached SecretStorage-2.3.1.tar.gz
    Requirement already satisfied: cryptography in /usr/lib64/python3.5/site-packages (from secretstorage; sys_platform == "linux2" or sys_platform == "linux"->keyring)
    Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /usr/lib64/python3.5/site-packages (from cryptography->secretstorage; sys_platform == "linux2" or sys_platform == "linux"->keyring)
    Collecting asn1crypto>=0.21.0 (from cryptography->secretstorage; sys_platform == "linux2" or sys_platform == "linux"->keyring)
      Downloading asn1crypto-0.24.0-py2.py3-none-any.whl (101kB)
        100% |████████████████████████████████| 102kB 285kB/s
    Collecting idna>=2.1 (from cryptography->secretstorage; sys_platform == "linux2" or sys_platform == "linux"->keyring)
      Using cached idna-2.6-py2.py3-none-any.whl
    Collecting six>=1.4.1 (from cryptography->secretstorage; sys_platform == "linux2" or sys_platform == "linux"->keyring)
      Using cached six-1.11.0-py2.py3-none-any.whl
    Collecting pycparser (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography->secretstorage; sys_platform == "linux2" or sys_platform == "linux"->keyring)
      Using cached pycparser-2.18.tar.gz
    Installing collected packages: secretstorage, keyring, asn1crypto, idna, six, pycparser
      Running setup.py install for secretstorage ... done
      Running setup.py install for pycparser ... done
    Successfully installed asn1crypto-0.24.0 idna-2.6 keyring-11.0.0 pycparser-2.18 secretstorage-2.3.1 six-1.11.0
    
    # pip3.5 install BeautifulSoup4
    Collecting BeautifulSoup4
      Using cached beautifulsoup4-4.6.0-py3-none-any.whl
    Installing collected packages: BeautifulSoup4
    Successfully installed BeautifulSoup4-4.6.0
    
    # pip3.5 install requests
    Collecting requests
      Using cached requests-2.18.4-py2.py3-none-any.whl
    Requirement already satisfied: idna<2.7,>=2.5 in /usr/lib/python3.5/site-packages (from requests)
    Collecting urllib3<1.23,>=1.21.1 (from requests)
      Using cached urllib3-1.22-py2.py3-none-any.whl
    Collecting certifi>=2017.4.17 (from requests)
      Downloading certifi-2018.1.18-py2.py3-none-any.whl (151kB)
        100% |████████████████████████████████| 153kB 1.8MB/s
    Collecting chardet<3.1.0,>=3.0.2 (from requests)
      Using cached chardet-3.0.4-py2.py3-none-any.whl
    Installing collected packages: urllib3, certifi, chardet, requests
    Successfully installed certifi-2018.1.18 chardet-3.0.4 requests-2.18.4 urllib3-1.22
    
    # pip3.5 install requests-kerberos
    Collecting requests-kerberos
      Downloading requests_kerberos-0.12.0-py2.py3-none-any.whl
    Requirement already satisfied: pykerberos<2.0.0,>=1.1.8; sys_platform != "win32" in /usr/lib64/python3.5/site-packages (from requests-kerberos)
    Requirement already satisfied: cryptography>=1.3; python_version != "3.3" in /usr/lib64/python3.5/site-packages (from requests-kerberos)
    Requirement already satisfied: requests>=1.1.0 in /usr/lib/python3.5/site-packages (from requests-kerberos)
    Requirement already satisfied: six>=1.4.1 in /usr/lib/python3.5/site-packages (from cryptography>=1.3; python_version != "3.3"->requests-kerberos)
    Requirement already satisfied: idna>=2.1 in /usr/lib/python3.5/site-packages (from cryptography>=1.3; python_version != "3.3"->requests-kerberos)
    Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /usr/lib64/python3.5/site-packages (from cryptography>=1.3; python_version != "3.3"->requests-kerberos)
    Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3.5/site-packages (from cryptography>=1.3; python_version != "3.3"->requests-kerberos)
    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.5/site-packages (from requests>=1.1.0->requests-kerberos)
    Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3.5/site-packages (from requests>=1.1.0->requests-kerberos)
    Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/lib/python3.5/site-packages (from requests>=1.1.0->requests-kerberos)
    Requirement already satisfied: pycparser in /usr/lib/python3.5/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography>=1.3; python_version != "3.3"->requests-kerberos)
    Installing collected packages: requests-kerberos
    Successfully installed requests-kerberos-0.12.0
    
    # pip3.5 install psutils
    Collecting psutils
      Could not find a version that satisfies the requirement psutils (from versions: )
    No matching distribution found for psutils
    [root@localhost SRPMS]# pip3.5 install psutil
    Requirement already satisfied: psutil in /usr/lib64/python3.5/site-packages
    
    # pip3.5 install crypto
    Collecting crypto
      Using cached crypto-1.4.1-py2.py3-none-any.whl
    Collecting Naked (from crypto)
      Using cached Naked-0.1.31-py2.py3-none-any.whl
    Collecting shellescape (from crypto)
      Using cached shellescape-3.4.1-py2.py3-none-any.whl
    Requirement already satisfied: pyyaml in /usr/lib64/python3.5/site-packages (from Naked->crypto)
    Requirement already satisfied: requests in /usr/lib/python3.5/site-packages (from Naked->crypto)
    Requirement already satisfied: idna<2.7,>=2.5 in /usr/lib/python3.5/site-packages (from requests->Naked->crypto)
    Requirement already satisfied: certifi>=2017.4.17 in /usr/lib/python3.5/site-packages (from requests->Naked->crypto)
    Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.5/site-packages (from requests->Naked->crypto)
    Requirement already satisfied: urllib3<1.23,>=1.21.1 in /usr/lib/python3.5/site-packages (from requests->Naked->crypto)
    Installing collected packages: Naked, shellescape, crypto
    Successfully installed Naked-0.1.31 crypto-1.4.1 shellescape-3.4.1
    
    # pip3.5 install cryptography
    Requirement already satisfied: cryptography in /usr/lib64/python3.5/site-packages
    Requirement already satisfied: idna>=2.1 in /usr/lib/python3.5/site-packages (from cryptography)
    Requirement already satisfied: cffi>=1.7; platform_python_implementation != "PyPy" in /usr/lib64/python3.5/site-packages (from cryptography)
    Requirement already satisfied: six>=1.4.1 in /usr/lib/python3.5/site-packages (from cryptography)
    Requirement already satisfied: asn1crypto>=0.21.0 in /usr/lib/python3.5/site-packages (from cryptography)
    Requirement already satisfied: pycparser in /usr/lib/python3.5/site-packages (from cffi>=1.7; platform_python_implementation != "PyPy"->cryptography)
    
    # pip3.5 install PyQt5
    Requirement already satisfied: PyQt5 in /usr/lib64/python3.5/site-packages
    Requirement already satisfied: sip<4.20,>=4.19.4 in /usr/lib64/python3.5/site-packages (from PyQt5)
    

А теперь внимание! Последний но важный шаг. Как вы можете видеть, пакет PyQt уже стоит, но беда в том, что pip по умолчанию ставит версию пакета 5.9 с котрой nagstamon отказывается работать - при запуске окно не отрисовывается! Надо обновить этот пакет до последней версии (на момент написания статьи 5.10):

# pip3.5 install --upgrade PyQt5
Collecting PyQt5
  Downloading PyQt5-5.10-5.10.0-cp35.cp36.cp37-abi3-manylinux1_x86_64.whl (110.0MB)
    100% |████████████████████████████████| 110.0MB 15kB/s
Collecting sip<4.20,>=4.19.4 (from PyQt5)
Collecting sip<4.20,>=4.19.4 (from PyQt5)
  Downloading sip-4.19.7-cp35-cp35m-manylinux1_x86_64.whl (66kB)
    100% |████████████████████████████████| 71kB 2.7MB/s
Installing collected packages: sip, PyQt5
  Found existing installation: sip 4.19.5
    Uninstalling sip-4.19.5:
      Successfully uninstalled sip-4.19.5
  Found existing installation: PyQt5 5.9.1
    Uninstalling PyQt5-5.9.1:
      Successfully uninstalled PyQt5-5.9.1
Successfully installed PyQt5-5.10 sip-4.19.7

и вот теперь, если вы наберёте команду nagstamon у вас должно всё заработать, несмотря на выдаваемые предупреждения.

0
Ваш рейтинг: Нет