Skip to content

Repository files navigation

DPN Monitor

A self-contained Laravel and Livewire package for monitoring Telstra DPN Service Assurance Portal bookings.

The package owns the booking models, database migrations, polling service, queued job, scheduler integration, console commands, and the booking list, detail, and history pages.

Important

Telstra does not expose this integration as a documented public API. The client uses the Next.js React Server Components and Server Actions interface used by the Telstra page, which may change without notice.

Requirements

  • PHP 8.2 or newer
  • Laravel 12
  • Livewire 4
  • Flux 2.9 or newer, free edition
  • An authenticated application layout named layouts.app
  • A queue worker and scheduler process for automatic polling

Installation

Add the repository to the consuming application's composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/JamesKennewell/DPN-Monitor.git"
        }
    ]
}

Install the package and run its migrations:

composer require jameskennewell/dpn-monitor
php artisan migrate

Laravel discovers DpnMonitor\DpnMonitorServiceProvider automatically. Its migrations are loaded directly by the package, so publishing them is optional.

What the package provides

  • DpnMonitor\Models\SapEvent
  • DpnMonitor\Models\SapEventSnapshot
  • DpnMonitor\Services\SapEventPoller
  • DpnMonitor\Jobs\PollSapEventJob
  • dpn-monitor:poll-live
  • dpn-monitor:poll {uuid}
  • Automatic once-per-minute dispatch of live booking polls
  • Booking list and creation page
  • Booking detail flyout with manual and automatic polling controls
  • Filterable endpoint history page

The package intentionally does not include Pathwatch dashboards, alert broadcasting, user management, roles, or unrelated service tables.

Routes

Method Path Name Purpose
GET /bookings sap.booking Booking list and creation
GET /bookings/{event}/history sap.booking.history Endpoint history

Add a navigation link with:

<a href="{{ route('sap.booking') }}">Bookings</a>

The default middleware is web, auth, and verified.

Configuration

Publish the package configuration when you need to change its defaults:

php artisan vendor:publish --tag=dpn-monitor-config

The published config/dpn-monitor.php controls the route prefix, route middleware, authorization abilities, polling frequency, queue name, and optional activity logging.

By default every authenticated, verified user can view and manage bookings. To use host-defined gates or Spatie permissions:

'abilities' => [
    'view' => 'bookings.view',
    'manage' => 'bookings.manage',
],

When spatie/laravel-activitylog is already installed, package actions are recorded automatically. It is not a required dependency.

Database

The package migration creates:

  • sap_events, containing booking identity, schedule, and polling state.
  • sap_event_snapshots, containing timestamped JSON service readings.

All package timestamps represent UTC instants. PostgreSQL applications should normally use:

'timezone' => env('DB_TIMEZONE', 'UTC'),

Automatic polling

The package schedules dpn-monitor:poll-live once per minute. That command queues one PollSapEventJob for each live booking with polling enabled.

Run both Laravel processes in production:

php artisan schedule:work
php artisan queue:work

Change or disable package scheduling in config/dpn-monitor.php:

'polling' => [
    'enabled' => true,
    'frequency' => 'everyMinute',
    'queue' => null,
],

The frequency must be a valid Laravel scheduled-event frequency method, such as everyMinute, everyFiveMinutes, or hourly.

Poll one UUID immediately:

php artisan dpn-monitor:poll 749445c0-269a-44c8-9f93-4a774e87e719

Use --no-store to inspect whether Telstra returns data without creating a booking or snapshot.

Timezones

Views use the authenticated user's timezone property when present, then fall back to config('app.timezone', 'UTC').

Use an IANA identifier such as Australia/Adelaide. The user column is optional; applications without it use the application timezone.

Using the client directly

use DpnMonitor\TelstraClient;

$services = app(TelstraClient::class)->scrape(
    '749445c0-269a-44c8-9f93-4a774e87e719',
);

$metadata = app(TelstraClient::class)->extractEventMetadata($services);

The client discovers the current Next.js Server Action identifier, normalises services, paths, CVLANs, endpoints, link state, throughput, optical power, and error data, and retries once if Telstra deploys between discovery and polling.

Operational notes

  • Treat endpoint and work-order data as operationally sensitive.
  • Keep the booking routes behind authentication and appropriate authorization.
  • Avoid tests that depend exclusively on a live event UUID because events expire.
  • Review Telstra's terms and obtain appropriate permission before deployment.

License

DPN Monitor is open-source software licensed under the MIT License.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages