Skip to content

AP Monitor is a powerful and flexible FastAPI-based application designed to provide real-time and historical monitoring of wireless Access Points (APs) and client counts by integrating with Cisco DNA Center APIs. This tool helps you effectively manage your wireless network by offering insights into client load, identifying trends, and providing

License

Notifications You must be signed in to change notification settings

Ghosts6/client_count

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

81 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AP Monitor

AP Monitor is a powerful and flexible FastAPI-based application designed to monitor wireless Access Points (APs) and client counts by integrating with Cisco DNA Center APIs. It provides real-time data, historical trends, and advanced diagnostics to help you manage your wireless network effectively.

Project Banner


✨ Features

  • Real-time Monitoring: Get up-to-the-minute client counts for your entire wireless network.
  • Historical Data: Store and query historical client count data to identify trends and patterns.
  • RESTful API: A comprehensive RESTful API for retrieving data and managing the application.
  • WebSocket Support: A WebSocket endpoint for receiving real-time updates of the total client count.
  • Advanced Diagnostics: A suite of diagnostic tools to help you identify and troubleshoot issues with your wireless network.
  • Flexible Configuration: Configure the application using environment variables to adapt it to your specific needs.
  • Docker Support: Deploy the application using Docker for easy and consistent deployments.
  • Authentication: Secure your API endpoints with API key authentication.
  • Caching: An in-memory cache to improve the performance of expensive API calls.

🚀 Getting Started

Prerequisites

  • Python 3.10+
  • PostgreSQL 12+
  • Docker (optional)

Installation

  1. Clone the repository:

    git clone https://github.com/your-username/client_count.git
    cd client_count
  2. Create and activate a virtual environment:

    python3 -m venv venv
    source venv/bin/activate
  3. Install the dependencies:

    pip install -r ap_monitor/requirements.txt
  4. Configure the application:

    Create a .env file in the root directory of the project and add the following environment variables:

    # Database Configuration
    DB_HOST=localhost
    DB_NAME=wireless_count
    DB_USER=postgres
    DB_PASSWORD=your_password
    DB_PORT=5432
    
    # DNA Center API Configuration
    DNA_API_URL=https://your-dnac-host/dna/intent/api/v1/
    DNA_USERNAME=your_username
    DNA_PASSWORD=your_password
    
    # Application Configuration
    LOG_LEVEL=INFO
    ENABLE_DIAGNOSTICS=true
    API_KEY=your-secret-api-key
  5. Initialize the database:

    python -c "from ap_monitor.app.db import init_db; init_db()"

Usage

To run the application, use the following command:

uvicorn ap_monitor.app.main:app --host 0.0.0.0 --port 8000

You can now access the API at http://localhost:8000.

Docker Deployment

To deploy the application using Docker, you can use the provided Dockerfile and docker-compose.yml files.

  1. Build the Docker image:

    docker build -t ap-monitor .
  2. Run the application using Docker Compose:

    docker-compose up

API Endpoints

The API is documented using OpenAPI (Swagger). You can access the interactive documentation at http://localhost:8000/docs.

All endpoints (except /health) require an API key to be passed in the X-API-Key header.


🧪 Running Tests

To run the tests, use the following command:

TESTING=true PYTHONPATH=ap_monitor pytest -v ap_monitor/tests/

🤝 Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.


📄 License

This project is licensed under the MIT License. See the LICENSE file for details.

About

AP Monitor is a powerful and flexible FastAPI-based application designed to provide real-time and historical monitoring of wireless Access Points (APs) and client counts by integrating with Cisco DNA Center APIs. This tool helps you effectively manage your wireless network by offering insights into client load, identifying trends, and providing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages