Usm iferr EN: различия между версиями

Материал из WiKi - UserSide
Нет описания правки
Нет описания правки
Строка 24: Строка 24:
  sudo apt install -y python3 python3-dev python3-pip
  sudo apt install -y python3 python3-dev python3-pip


Download the archive, extract the directory with the module files from it (you should do this also when upgrading). You can use [[Python_venv|virtual python environment]] with the appropriate fixes to the commands below, or install everything according to these instructions globally.
Download the archive, extract the directory with the module files from it (you should do this also when upgrading). You can use [[Python_venv_EN|virtual python environment]] with the appropriate fixes to the commands below, or install everything according to these instructions globally.
Navigate to this directory and install the dependencies by entering the following command:
Navigate to this directory and install the dependencies by entering the following command:
  sudo pip3 install --upgrade -r requirements.txt
  sudo pip3 install --upgrade -r requirements.txt
Строка 66: Строка 66:


  /var/log/userside/*.log            644  7      *    @T00  GJC
  /var/log/userside/*.log            644  7      *    @T00  GJC


=== Rotation in Linux ===
=== Rotation in Linux ===

Версия от 15:26, 25 октября 2023

en | ru

usm_iferr - module for periodic polling (via SNMP) of error counters on equipment interfaces. This allows you to see devices with errors on interfaces (both in terms of interfaces and the number of problematic interfaces for each device). It also plots the delta of error growth for a day and for a week, which allows you to see devices where problems continue right now.

Module Language: Python

Current version: see page: Modules

Module Status: Paid

Description

On each run, the module receives from Userside 50 (default) nodes to be polled, performs the poll, and returns the result to Userside. If all nodes in the iteration are available and contain the correct settings, one iteration takes about 2..3 seconds. Polling is performed in asynchronous mode (first 50 SNMP requests are formed and sent to the network simultaneously, then the module waits for responses and processes them or detects errors).

You can run several copies of the module in parallel to speed up the process. You can also increase the number of nodes per asynchronous iteration (default is 50) as long as the network subsystem can handle it. We still recommend using a value of 50 for the number_of_nodes parameter, which defines the number of nodes in an iteration.

Requirements

  • Python 3.5
  • USERSIDE 3.13.53+

Installation

Install Python and the pip package manager

sudo apt install -y python3 python3-dev python3-pip

Download the archive, extract the directory with the module files from it (you should do this also when upgrading). You can use virtual python environment with the appropriate fixes to the commands below, or install everything according to these instructions globally. Navigate to this directory and install the dependencies by entering the following command:

sudo pip3 install --upgrade -r requirements.txt

Then, if this is an initial installation, copy the settings.ini-example file named settings.ini

sudo cp settings.ini-example settings.ini

Edit this file:

Specify the correct values for the api section - URL of your USERSIDE and API key. The number_of_nodes parameter value is also specified there (default = 50) - this is the number of nodes the module will process in one run.

Startup

Run the module manually

python3 usm_iferr.py

The console will display the module operation log. Make sure that the module is working correctly (no errors, all nodes that should be available have been polled by the module without errors, information has been sent to userside without errors), then edit the settings.ini file again, specifying in the [log] section for the to_console parameter the value no, and for the level parameter the value 2. You may also need to specify the path for log file formation in the path parameter. If there are errors in the module operation - try to eliminate them or contact our support service for help.

Automatic launch

Once the manual launch test is complete and all necessary changes have been made to the config, add a task to the system cron to run the module automatically. The frequency of launch depends on the total number of nodes in your network and the number_of_nodes parameter in the module's config. Try to choose the frequency so that all nodes in your network are polled in about 15 minutes if you need to get information about errors on interfaces quickly.

The cron entry looks the usual way:

*/5 *  * * *  root   python3 /path/to/module/usm_iferr.py > /dev/null

Wait until at least one module integration has been performed, then check the contents of the log file:

tail -f /var/log/userside/usm_iferr.log

If the log file was not created after the module was supposed to run, refer to the operating system system log to identify the problem with running the process in the scheduler.

Remember that in FreeBSD you must specify the full path to the python3 interpreter, or you must put it in the PATH variable of the /etc/crontab file

Log file rotation

The log files created by the module need to be rotated. To do this, the standard log rotation tools in the operating system should be used.

The following configuration will rotate all *.log files every day and store 7 archive copies (for 7 days)

Rotation in FreeBSD

On FreeBSD, the newsyslog daemon is responsible for rotation. Create the file /usr/local/etc/newsyslog.conf.d/userside, in which place the following line (don't forget the path if you changed it):

/var/log/userside/*.log             644  7      *    @T00  GJC

Rotation in Linux

In Linux, the logrotate daemon is responsible for rotation. Create a file /etc/logrotate.d/userside, in which put the following text (don't forget the path if you change it):

/var/log/userside/*.log {
    rotate 7
    daily
    compress
    delaycompress
    missingok
    notifempty
}