Skip to content

bieyas/noc-management-system

Repository files navigation

πŸš€ NOC Management System (NOC Assistant)

Sistem manajemen Network Operation Center (NOC) untuk ISP (Internet Service Provider) dengan fitur monitoring jaringan, manajemen pelanggan, billing otomatis, dan alert system.

License Node MariaDB

πŸ“‹ Fitur Utama

πŸ” Authentication & Authorization

  • JWT-based authentication
  • Role-based access control (Admin, Staff, Customer)
  • Secure password hashing dengan bcrypt

πŸ‘₯ Customer Management

  • CRUD pelanggan lengkap
  • Informasi kontak dan alamat
  • Status pelanggan (active, suspended, inactive)
  • Auto-generate Customer ID

πŸ–₯️ Device Monitoring

  • Monitor device secara real-time (router, switch, access point)
  • Ping monitoring otomatis
  • Network logs history
  • Device status tracking (online/offline)
  • Support SNMP (v1, v2c, v3)

πŸ“¦ Subscription Management

  • Paket internet customizable
  • Bandwidth management
  • Subscription lifecycle (active, expired, suspended)
  • Auto-renewal options
  • Expiring subscription alerts

πŸ’° Billing & Payment

  • Invoice generation otomatis
  • Multiple payment methods (cash, transfer, e-wallet, credit card)
  • Payment status tracking (pending, paid, overdue)
  • Payment statistics & reports
  • Monthly revenue reports

🚨 Alert System

  • Real-time alerts untuk network issues
  • Multiple severity levels (critical, high, medium, low)
  • Alert acknowledgment & resolution workflow
  • Alert statistics
  • Custom alert types

πŸ“Š Bandwidth Monitoring

  • Real-time bandwidth usage tracking
  • Customer bandwidth summary
  • Top bandwidth consumers
  • Historical usage data

πŸ€– Automation

  • Automated device monitoring (ping checks)
  • Automatic overdue payment detection
  • Subscription expiration automation
  • Alert generation untuk critical events
  • Billing reminders (7 days before due date)

πŸ› οΈ Tech Stack

Backend:

  • Node.js v20+ - Runtime environment
  • Express.js v4.18 - Web framework
  • Sequelize v6.35 - ORM (Object-Relational Mapping)
  • MariaDB v10.11 - Primary database
  • Redis v7 - Caching layer
  • JWT - Authentication tokens
  • bcrypt - Password hashing
  • node-cron - Task scheduling
  • ping - Network monitoring

Infrastructure:

  • Docker & Docker Compose - Containerization
  • phpMyAdmin - Database management UI

πŸ“ Struktur Project

nocman/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ config/          # Database & Redis configuration
β”‚   β”‚   β”œβ”€β”€ controllers/     # Request handlers (8 controllers)
β”‚   β”‚   β”œβ”€β”€ middleware/      # Auth & validation middleware
β”‚   β”‚   β”œβ”€β”€ models/          # Sequelize models (8 models)
β”‚   β”‚   β”œβ”€β”€ routes/          # API routes
β”‚   β”‚   β”œβ”€β”€ services/        # Business logic (monitoring, billing)
β”‚   β”‚   └── index.js         # Server entry point
β”‚   β”œβ”€β”€ scripts/
β”‚   β”‚   β”œβ”€β”€ seedAdmin.js     # Create admin user
β”‚   β”‚   β”œβ”€β”€ seedData.js      # Generate sample data
β”‚   β”‚   └── syncDatabase.js  # Database synchronization
β”‚   β”œβ”€β”€ test-api.sh          # Basic API tests
β”‚   β”œβ”€β”€ test-integration.sh  # Integration tests
β”‚   β”œβ”€β”€ package.json
β”‚   └── .env.example
β”œβ”€β”€ docker/
β”‚   β”œβ”€β”€ docker-compose.yml   # Docker services configuration
β”‚   └── .env.example
β”œβ”€β”€ DEPLOYMENT.md            # Deployment guide
└── README.md

πŸš€ Quick Start

Prerequisites

  • Node.js v18.0.0 atau lebih tinggi
  • Docker & Docker Compose
  • Git

Installation

  1. Clone repository
git clone https://github.com/your-username/nocman.git
cd nocman
  1. Setup Docker services
cd docker
cp .env.example .env
# Edit .env dan sesuaikan password

docker-compose up -d
  1. Setup Backend
cd ../backend
cp .env.example .env
# Edit .env dan sesuaikan dengan konfigurasi Docker

npm install
  1. Database Setup
# Sync database tables
npm run db:sync

# Create admin user
npm run seed:admin
  1. Start Server
# Development mode
npm run dev

# Production mode
npm start
  1. Verify Installation
# Run integration tests
chmod +x test-integration.sh
./test-integration.sh

Server akan berjalan di: http://localhost:5000

🎯 Default Admin Credentials

Username: admin
Password: admin123

⚠️ PENTING: Ganti password admin setelah instalasi pertama!

πŸ“Š Sample Data (Optional)

Untuk development/testing, generate sample data:

npm run seed:data

Ini akan membuat:

  • πŸ‘₯ 10 Customers (ISP clients)
  • πŸ–₯️ 26+ Devices (routers, switches, access points)
  • πŸ“¦ 10 Subscriptions (berbagai paket internet)
  • πŸ’° 17+ Payments (dengan berbagai status)
  • 🚨 15+ Alerts
  • πŸ“Š 200+ Network logs
  • πŸ“ˆ 56+ Bandwidth usage records

πŸ”Œ API Endpoints

Authentication

POST   /api/auth/register      # Register user baru
POST   /api/auth/login         # Login & get JWT token
GET    /api/auth/me            # Get current user profile

Customers

GET    /api/customers          # Get all customers
GET    /api/customers/:id      # Get single customer
POST   /api/customers          # Create customer
PUT    /api/customers/:id      # Update customer
DELETE /api/customers/:id      # Delete customer

Devices

GET    /api/devices            # Get all devices
GET    /api/devices/:id        # Get single device
POST   /api/devices            # Add device
PUT    /api/devices/:id        # Update device
DELETE /api/devices/:id        # Delete device
GET    /api/devices/stats      # Device statistics
GET    /api/devices/:id/logs   # Device network logs

Subscriptions

GET    /api/subscriptions               # Get all subscriptions
GET    /api/subscriptions/:id           # Get single subscription
POST   /api/subscriptions               # Create subscription
PUT    /api/subscriptions/:id           # Update subscription
DELETE /api/subscriptions/:id           # Delete subscription
GET    /api/subscriptions/expiring      # Get expiring subscriptions

Payments

GET    /api/payments                    # Get all payments
GET    /api/payments/:id                # Get single payment
POST   /api/payments                    # Create payment
PUT    /api/payments/:id                # Update payment
PUT    /api/payments/:id/process        # Process payment
DELETE /api/payments/:id                # Delete payment
GET    /api/payments/stats              # Payment statistics
GET    /api/payments/revenue/monthly    # Monthly revenue report

Alerts

GET    /api/alerts                      # Get all alerts
GET    /api/alerts/:id                  # Get single alert
POST   /api/alerts                      # Create alert
PUT    /api/alerts/:id/acknowledge      # Acknowledge alert
PUT    /api/alerts/:id/resolve          # Resolve alert
PUT    /api/alerts/:id/dismiss          # Dismiss alert
DELETE /api/alerts/:id                  # Delete alert
GET    /api/alerts/stats                # Alert statistics

Bandwidth

GET    /api/bandwidth                           # Get bandwidth usage
GET    /api/bandwidth/:id                       # Get single record
POST   /api/bandwidth                           # Create record
GET    /api/bandwidth/customer/:id/summary     # Customer bandwidth summary
GET    /api/bandwidth/top                       # Top bandwidth consumers

πŸ”§ Configuration

Environment Variables

Backend (backend/.env):

NODE_ENV=production
PORT=5000
DB_HOST=localhost
DB_PORT=3307
DB_NAME=nocman_db
DB_USER=nocman_user
DB_PASSWORD=your_secure_password
REDIS_HOST=localhost
REDIS_PORT=6379
JWT_SECRET=your_32_char_secret_key
JWT_EXPIRE=7d

Docker (docker/.env):

MYSQL_ROOT_PASSWORD=secure_root_password
MYSQL_DATABASE=nocman_db
MYSQL_USER=nocman_user
MYSQL_PASSWORD=your_secure_password
REDIS_PASSWORD=secure_redis_password

🐳 Docker Services

Akses Docker Services:

  • MariaDB: localhost:3307
  • Redis: localhost:6379
  • phpMyAdmin: http://localhost:8081
    • Server: nocman_mariadb
    • Username: nocman_user
    • Password: sesuai docker/.env

Docker Commands:

# Start services
docker-compose up -d

# Stop services
docker-compose down

# View logs
docker-compose logs -f

# Restart service
docker-compose restart mariadb

# Remove all data (WARNING: deletes all data!)
docker-compose down -v

πŸ§ͺ Testing

# Basic API test
./test-api.sh

# Integration test
./test-integration.sh

# Manual testing dengan curl
curl -X POST http://localhost:5000/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"admin123"}'

πŸ“ˆ Monitoring

Built-in Services

  1. Device Monitoring

    • Automatic ping checks setiap 60 detik
    • Generate alerts untuk device offline
    • Network log history
  2. Billing Automation

    • Overdue payment check: Daily at 9 AM
    • Upcoming payment reminder: Daily at 8 AM
    • Expiring subscription check: Daily at 7 AM
    • Auto-expire subscriptions: Daily at midnight

Logs

# Server logs
npm run dev  # dengan nodemon (auto-reload)

# Docker logs
docker-compose logs -f mariadb
docker-compose logs -f redis

🚒 Deployment

Lihat DEPLOYMENT.md untuk panduan deployment lengkap ke:

  • VPS (Ubuntu/Debian)
  • Cloud platforms (AWS, DigitalOcean, etc)
  • Production best practices

Quick Production Setup:

# Set NODE_ENV
export NODE_ENV=production

# Install dependencies (production only)
npm ci --production

# Start with PM2
npm install -g pm2
pm2 start src/index.js --name nocman-api
pm2 startup
pm2 save

πŸ”’ Security Considerations

  • βœ… JWT token-based authentication
  • βœ… Password hashing dengan bcrypt
  • βœ… Environment variables untuk sensitive data
  • βœ… CORS configuration
  • βœ… SQL injection prevention (Sequelize ORM)
  • βœ… Input validation
  • ⚠️ Change default passwords setelah instalasi
  • ⚠️ Use HTTPS di production
  • ⚠️ Implement rate limiting (optional)
  • ⚠️ Regular security updates

🀝 Contributing

Contributions welcome! Silakan:

  1. Fork repository
  2. Create feature branch (git checkout -b feature/AmazingFeature)
  3. Commit changes (git commit -m 'Add some AmazingFeature')
  4. Push to branch (git push origin feature/AmazingFeature)
  5. Open Pull Request

πŸ“ License

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

πŸ‘¨β€πŸ’» Authors

  • Initial work - Development & Migration to MariaDB

πŸ™ Acknowledgments

  • Express.js community
  • Sequelize ORM documentation
  • Docker community
  • All open-source contributors

πŸ“ž Support

Jika mengalami masalah:

  1. Check Issues
  2. Create new issue dengan detail error
  3. Sertakan:
    • Node.js version
    • OS information
    • Error logs
    • Steps to reproduce

πŸ—ΊοΈ Roadmap

  • Frontend dashboard (React/Next.js)
  • Real-time monitoring dengan WebSocket
  • Email notification integration
  • SMS notification (Twilio/Nexmo)
  • WhatsApp integration
  • PDF invoice generation
  • Multi-tenant support
  • Grafana/Prometheus integration
  • Mobile app (React Native)
  • Advanced SNMP monitoring
  • Network topology visualization
  • Automated backup system

Made with ❀️ for ISP Network Operations

About

NOC Management System for ISP - Device Monitoring, Billing, and Alert Management

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors