ejtj3 / nats-monitoring
Nats monitoring api wrapper
Installs: 1 969
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
Open Issues: 4
Requires
- php: ^8.1
- jms/serializer: ^3.0
- php-http/discovery: ^1.19
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.62
- jms/serializer: 3.28.0
- nyholm/psr7: ^1.8
- phpro/grumphp-shim: ^2.3
- phpstan/phpstan: ^2.0
- phpunit/phpunit: ^10.0
- symfony/http-client: 6.4.*
This package is auto-updated.
Last update: 2025-03-17 21:55:39 UTC
README
Nats monitoring
$ composer require ejtj3/nats-monitoring jms/serializer
use EJTJ3\NatsMonitoring\Jms\Serializer\Handler\NatsDateImmutableHandler; use EJTJ3\NatsMonitoring\Jms\Serializer\Handler\NatsDateIntervalHandler; use EJTJ3\NatsMonitoring\Model\ConnectionRequest; use EJTJ3\NatsMonitoring\NatsMonitoringClient; use JMS\Serializer\Handler\HandlerRegistry; use JMS\Serializer\SerializerBuilder; use Symfony\Component\HttpClient\Psr18Client; // build serializer $serializerBuilder = new SerializerBuilder(); $serializerBuilder->configureHandlers(static function (HandlerRegistry $registry): void { $registry->registerSubscribingHandler(new NatsDateIntervalHandler()); $registry->registerSubscribingHandler(new NatsDateImmutableHandler()); }); $serializer = $serializerBuilder->build(); $client = new NatsMonitoringClient( serializer: $serializer, client: new Psr18Client(), ); $requestOptions = new ConnectionRequest(); $requestOptions->setAuth(true); $connections = $client->getConnections('https://demo.nats.io:8222', $requestOptions);
Available methods
Name | Route | Method |
---|---|---|
General | /varz | $client->getGeneralSettings('https://demo.nats.io:8222') |
Jetstream | /jsz | $client->getJetstream('https://demo.nats.io:8222') |
Connections | /connz | $client->getConnections('https://demo.nats.io:8222') |
Accounts | /accountz | $client->getAccounts('https://demo.nats.io:8222') |
Account stats | /accstatz | $client->getAccountStats('https://demo.nats.io:8222') |
Subscriptions | /subsz | $client->getSubscriptions('https://demo.nats.io:8222') |
Routes | /routez | $client->getRoutez('https://demo.nats.io:8222') |
Leafnodes | /leafz | $client->getLeafnodes('https://demo.nats.io:8222') |
Gateways | /gatewayz | Not yet implemented |
HealthProbe | /leafz | $client->getHealth('https://demo.nats.io:8222') |