semvec/pypi-packages huggingface dataset:
ashar-website-monitor 0.1.0
A Python tool to periodically check website availability and content with structured logging.
Requires Python: >=3.7

# Website Monitoring Tool

A Python-based website monitoring tool that periodically checks the availability and content of specified websites, logging detailed structured JSON logs and console output.

---

## Features

- Periodic checks of multiple URLs with user-defined intervals.
- Validates HTTP response status codes.
- Verifies presence of expected content in the response.
- Handles and logs connection errors, timeouts, and HTTP errors.
- Structured logging to console and JSON file with rich metadata.
- Configurable via YAML file.

---
## Project Structure

## Project Structure

```text
├── ashar_website_monitor/
│   ├── config/
│   │   └── config.yaml             # User input config for URLs and checking period
│   ├── logs/
│   │   └── monitoring_logs.json    # JSON log output
│   ├── src/
│   │   ├── logger_config.py        # Custom logger setup with JSON formatter
│   │   ├── monitor.py              # Monitor class to run periodic checks
│   │   └── website.py              # Website class to handle individual site checks
│   ├── __init__.py
│   ├── main.py                     # Main script to load config and start monitoring
├── tests/
│   ├── test_website.py             # Unit tests for Website class
│   └── test_monitor.py             # Unit tests for Monitor class
├── .gitignore                      # Git ignore file
├── pyproject.toml                  # Pip package setup file
├── requirements.txt                # Package requrements
└── README.md                       # This documentation

---

## Configuration

Create a YAML config file specifying the checking period and URLs to monitor.

Example `config/config.yaml`:

```yaml
checking_period: 7

urls:
  - url: "https://www.google.com/"
    expected_content: "Google"
  - url: "https://www.facebook.com/"
    expected_content: "ok pk hello bye"
  - url: "https://httpbin.org/status/404"
    expected_content: "hello world"
  - url: "http://thisdomaindoesnotexist1234567890.com"
    expected_content: "anything"
  - url: "https://httpbin.org/delay/10"
    expected_content: "Delayed"
  - url: "htp://invalid-url.com"
    expected_content: "test"
  - url: "https://httpbin.org/status/500"
    expected_content: "internal"
```

## Usage

### Pre requisites

- Python 3.7+
- Install dependencies:

```
pip install -r requirements.txt
```

### Run the monitor

```
python main.py --config config/config.yaml
```

### Testing

Run all tests with:

```
PYTHONPATH=./ashar_website_monitor pytest -v tests/
```


## Logging

Logs structured JSON entries containing:

- asctime (timestamp)
- url
- status_code
- response_time
- levelname
- error_type
- message

Logs are written both to console (plain text) and JSON file.
nvidia-docker-smi 0.1.0
A tool to monitor NVIDIA GPU usage across Docker containers
Requires Python: >=3.6

# nvidia-docker-smi

A command-line tool to monitor NVIDIA GPU usage across Docker containers.

## Installation

```bash
pip install nvidia-docker-smi
```

## Usage

Simply run:

```
> nvidia-docker-smi

--- GPU Summary ---
GPU-0: Util: 0%, Mem: 6735M/11019M (Free: 4284M)
GPU-1: Util: 0%, Mem: 8M/11019M (Free: 11011M)
GPU-2: Util: 0%, Mem: 5938M/11019M (Free: 5081M)
GPU-3: Util: 0%, Mem: 8M/11019M (Free: 11011M)
-------------------

pid      user  proc             type  container             gpu_util  gpu_mem  cpu   mem   gpu
3405     root  Xorg             G     -                     0%        N/A      0.0%  0.0%  GPU-0
902386   root  python3          C     data_collector        0%        439M     0.2%  0.5%  GPU-0
2343459  root  api_server       C     api_server            0%        511M     0.1%  0.1%  GPU-0
2343966  root  python           C     ai_server             0%        5777M    1.9%  3.2%  GPU-0
3405     root  Xorg             G     -                     0%        N/A      0.0%  0.0%  GPU-1
3405     root  Xorg             G     -                     0%        N/A      0.0%  0.0%  GPU-2
1944839  root  api_server       C     api_server_caleb      0%        511M     0.0%  0.1%  GPU-2
1944937  root  python           C     ai_server_caleb       0%        5419M    0.1%  3.2%  GPU-2
3405     root  Xorg             G     -                     0%        N/A      0.0%  0.0%  GPU-3
```

Add --debug flag for performance profiling:

```
> nvidia-docker-smi --debug

...

--- Performance Profile ---
refresh_container_pid_map     :   0.0752s ( 18.4%)
get_gpu_memory_usage          :   0.0452s ( 11.1%)
get_gpu_stats                 :   0.0471s ( 11.6%)
get_ps_data                   :   0.1181s ( 29.0%)
get_container_map             :   0.0020s (  0.5%)
display_gpu_summary           :   0.0429s ( 10.5%)
prepare_data_rows             :   0.0737s ( 18.1%)
display_formatted_output      :   0.0036s (  0.9%)
Total execution time          :   0.4079s
---------------------------
```

## Requirements
- Python 3.6 or higher
- NVIDIA GPU with installed drivers
- Docker

5. Install the package locally for development:

```bash
cd nvidia_docker_smi
pip install -e .
```