nginx-lens 0.1.2__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/PKG-INFO +1 -1
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/analyze.py +14 -1
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/diff.py +3 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/graph.py +4 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/health.py +4 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/include.py +4 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/logs.py +11 -1
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/route.py +3 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/syntax.py +7 -1
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/tree.py +5 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/nginx_lens.egg-info/PKG-INFO +1 -1
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/setup.py +1 -2
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/__init__.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/base.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/conflicts.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/dead_locations.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/diff.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/duplicates.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/empty_blocks.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/include.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/rewrite.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/route.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/unused.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/analyzer/warnings.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/__init__.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/commands/cli.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/exporter/__init__.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/exporter/graph.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/exporter/html.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/exporter/markdown.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/nginx_lens.egg-info/SOURCES.txt +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/nginx_lens.egg-info/dependency_links.txt +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/nginx_lens.egg-info/entry_points.txt +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/nginx_lens.egg-info/requires.txt +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/nginx_lens.egg-info/top_level.txt +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/parser/__init__.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/parser/nginx_parser.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/pyproject.toml +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/setup.cfg +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/tests/test_conflicts.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/tests/test_duplicates.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/tests/test_empty_blocks.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/tests/test_health.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/tests/test_parser.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/upstream_checker/__init__.py +0 -0
- {nginx_lens-0.1.2 → nginx_lens-0.1.3}/upstream_checker/checker.py +0 -0
|
@@ -15,7 +15,20 @@ console = Console()
|
|
|
15
15
|
|
|
16
16
|
def analyze(config_path: str = typer.Argument(..., help="Путь к nginx.conf")):
|
|
17
17
|
"""
|
|
18
|
-
Анализирует конфигурацию Nginx на типовые
|
|
18
|
+
Анализирует конфигурацию Nginx на типовые проблемы и best practices.
|
|
19
|
+
|
|
20
|
+
Показывает:
|
|
21
|
+
- Конфликты location-ов
|
|
22
|
+
- Дублирующиеся директивы
|
|
23
|
+
- Пустые блоки
|
|
24
|
+
- Потенциальные проблемы (proxy_pass без схемы, autoindex on, if, server_tokens on, SSL, лимиты, deprecated и др.)
|
|
25
|
+
- Неиспользуемые переменные
|
|
26
|
+
- Конфликты listen/server_name
|
|
27
|
+
- Проблемы с rewrite
|
|
28
|
+
- Мертвые location-ы
|
|
29
|
+
|
|
30
|
+
Пример:
|
|
31
|
+
nginx-lens analyze /etc/nginx/nginx.conf
|
|
19
32
|
"""
|
|
20
33
|
tree = parse_nginx_config(config_path)
|
|
21
34
|
conflicts = find_location_conflicts(tree)
|
|
@@ -12,6 +12,10 @@ def graph(
|
|
|
12
12
|
):
|
|
13
13
|
"""
|
|
14
14
|
Генерирует схему маршрутизации nginx (dot/mermaid).
|
|
15
|
+
|
|
16
|
+
Пример:
|
|
17
|
+
nginx-lens graph /etc/nginx/nginx.conf --format dot
|
|
18
|
+
nginx-lens graph /etc/nginx/nginx.conf --format mermaid
|
|
15
19
|
"""
|
|
16
20
|
tree = parse_nginx_config(config_path)
|
|
17
21
|
if format == "dot":
|
|
@@ -14,6 +14,10 @@ def health(
|
|
|
14
14
|
):
|
|
15
15
|
"""
|
|
16
16
|
Проверяет доступность upstream-серверов, определённых в nginx.conf. Выводит таблицу.
|
|
17
|
+
|
|
18
|
+
Пример:
|
|
19
|
+
nginx-lens health /etc/nginx/nginx.conf
|
|
20
|
+
nginx-lens health /etc/nginx/nginx.conf --timeout 5 --retries 3
|
|
17
21
|
"""
|
|
18
22
|
tree = parse_nginx_config(config_path)
|
|
19
23
|
upstreams = tree.get_upstreams()
|
|
@@ -13,6 +13,10 @@ def include_tree(
|
|
|
13
13
|
):
|
|
14
14
|
"""
|
|
15
15
|
Показывает дерево include-ов, циклы и shadowing директив.
|
|
16
|
+
|
|
17
|
+
Пример:
|
|
18
|
+
nginx-lens include-tree /etc/nginx/nginx.conf
|
|
19
|
+
nginx-lens include-tree /etc/nginx/nginx.conf --directive server_name
|
|
16
20
|
"""
|
|
17
21
|
tree = build_include_tree(config_path)
|
|
18
22
|
rich_tree = Tree(f"[bold blue]{config_path}[/bold blue]")
|
|
@@ -15,7 +15,17 @@ def logs(
|
|
|
15
15
|
top: int = typer.Option(10, help="Сколько топ-значений выводить")
|
|
16
16
|
):
|
|
17
17
|
"""
|
|
18
|
-
Анализирует access.log/error.log
|
|
18
|
+
Анализирует access.log/error.log.
|
|
19
|
+
|
|
20
|
+
Показывает:
|
|
21
|
+
- Топ HTTP-статусов (404, 500 и др.)
|
|
22
|
+
- Топ путей
|
|
23
|
+
- Топ IP-адресов
|
|
24
|
+
- Топ User-Agent
|
|
25
|
+
- Топ путей с ошибками 404/500
|
|
26
|
+
|
|
27
|
+
Пример:
|
|
28
|
+
nginx-lens logs /var/log/nginx/access.log --top 20
|
|
19
29
|
"""
|
|
20
30
|
status_counter = Counter()
|
|
21
31
|
path_counter = Counter()
|
|
@@ -16,7 +16,13 @@ def syntax(
|
|
|
16
16
|
nginx_path: str = typer.Option("nginx", help="Путь к бинарю nginx (по умолчанию 'nginx')")
|
|
17
17
|
):
|
|
18
18
|
"""
|
|
19
|
-
Проверяет синтаксис nginx-конфига через nginx -t.
|
|
19
|
+
Проверяет синтаксис nginx-конфига через nginx -t.
|
|
20
|
+
|
|
21
|
+
В случае ошибки показывает место в виде таблицы с контекстом.
|
|
22
|
+
|
|
23
|
+
Пример:
|
|
24
|
+
nginx-lens syntax /etc/nginx/nginx.conf
|
|
25
|
+
nginx-lens syntax /etc/nginx/nginx.conf --nginx-path /usr/local/sbin/nginx
|
|
20
26
|
"""
|
|
21
27
|
cmd = [nginx_path, "-t", "-c", os.path.abspath(config_path)]
|
|
22
28
|
try:
|
|
@@ -28,6 +28,11 @@ def tree(
|
|
|
28
28
|
):
|
|
29
29
|
"""
|
|
30
30
|
Визуализирует структуру nginx.conf в виде дерева.
|
|
31
|
+
|
|
32
|
+
Пример:
|
|
33
|
+
nginx-lens tree /etc/nginx/nginx.conf
|
|
34
|
+
nginx-lens tree /etc/nginx/nginx.conf --markdown
|
|
35
|
+
nginx-lens tree /etc/nginx/nginx.conf --html
|
|
31
36
|
"""
|
|
32
37
|
tree_obj = parse_nginx_config(config_path)
|
|
33
38
|
root = RichTree(f"[bold blue]nginx.conf[/bold blue]")
|
|
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
|
|
|
2
2
|
|
|
3
3
|
setup(
|
|
4
4
|
name="nginx-lens",
|
|
5
|
-
version="0.1.
|
|
5
|
+
version="0.1.3",
|
|
6
6
|
description="CLI-инструмент для анализа, визуализации и диагностики конфигураций Nginx",
|
|
7
7
|
author="Daniil Astrouski",
|
|
8
8
|
author_email="shelovesuastra@gmail.com",
|
|
@@ -12,7 +12,6 @@ setup(
|
|
|
12
12
|
"typer[all]>=0.9.0",
|
|
13
13
|
"rich>=13.0.0",
|
|
14
14
|
"requests>=2.25.0",
|
|
15
|
-
# "textual>=0.30.0", # опционально для интерактивного режима
|
|
16
15
|
],
|
|
17
16
|
entry_points={
|
|
18
17
|
"console_scripts": [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|