New features.
Closed this issue · 3 comments
I like your server monitor, thanks for it. But in my projects I had to change some behavior.
And now I want to propose you some features. It will be a list and if you approve some of them I'll create pull requests with this.
server-monitor:run-checks
- Add force mode to run checks right now. Example:
php artisan server-monitor:run-checks -f
php artisan server-monitor:run-checks --force
- Add
host
option to run checks only for host(s). It can be array, like:
php artisan server-monitor:run-checks -f --host=example.com --host=example2.com
- Add
check
option to tun only selected checks. It also can be array, like:
php artisan server-monitor:run-checks -f --host=example.com --check=mysql --check=diskspace
Also host/check optins can be comma separated, like
php artisan server:monitor:run-checks -f --host=example.com,example2.com --check=mysql,diskspace
but I like first one more.
server-monitor:sync-file
- Allow to use different file formats, like
yaml
. - Allow to set custom properties to check in files. Example:
[
{
"name": "my-host.com",
"checks": [
"diskspace",
"mysql",
{
"redis": {
"collect_used_memory": true
}
}
]
}
]
server-monitor:list-hosts
and server-monitor:list-checks
- Change
host
andcheck
option to array. Example:
php artisan server-monitor:list-checks --host=example1.com --host=example2.com
- Add
grep
option to search something in result set.
Why not use pipegrep
?
php artisan server-monitor:list-checks | grep something
will grep only rows with something
, not table structure, not flag, that checks was succeed or failed.
But example
php artisan server-monitor:list-checks --grep=something
will draw tables as always, but filter each column via str_contains()
for example.
Host options
One virtual host can be in many ip servers, and also can have a lot of mirrors. So I propose to:
- Add possibility to set
ip
as array and execute check in all IP addresses. Also it can be added additional option torun-checks/list-check/list-host
likeip
to filter via ip too . Example:
[
{
"name": "myhost.com",
"ip": ["127.0.0.1", "127.0.0.2"]
}
]
- Add new option as
mirror
. It's likealias
. And when you search checks for special host you can set mirror and it will find correct host. Example:
[
{
"name": "example.com",
"mirrors": ["example2.com", "localhost"]
}
]
And when you want to see checks you can call
php artisan server-monitor:list-checks --host=example.com
or
php artisan server:monitor:list-checks --host=localhost
The result will be the same.
Default checks.
- Add addition outbox checks for rabbitmq/redis/supervisor/mongo etc.
Other
- Add contracts for repositories and remove static methods. And inject interfaces to the commands.
class SyncFile extends Command
{
...
public function handle(CheckRepository $checkRepository)
{
///
}
}
Or alternatively add CheckRepositoryAware
and HostRepositoryAware
interfaces and doing something like:
// ServerProvider
public function register()
{
$this->app->afterResolving(CheckRepositoryAware::class, function(CheckRepositoryAware $aware) {
$aware->setCheckRepository(
$this->app->make(CheckRepository::class)
);
});
}
class SyncFile extends Command implements CheckRepositoryAware
{
use HasCheckRepository;
}
What of them will you review ?
Hi! Thank you for your proposals!
server-monitor:run-checks
send fully tested PRs for this. Also send a PR to our documentation repo with examples of the new functionality.
server-monitor:sync-file
I don't need other file formats, and I don't want to maintain code that I won't use. Do this in your own projects
Change host and check option to array. Example:
Send a separate PR for this.
Add grep option
I don't think this is needed.
Host options
I'd like to keep this package simple, so I'm going to hold off for now
Default checks.
I don't understand what you are proposing
Other
I don't see any benefits in doing this.
@freekmurze , thanks for your answer.
server-monitor:sync-file
I don't need other file formats, and I don't want to maintain code that I won't use. Do this in your own projects
Can I create PR with moving getting hostsInFile
to another method? no in handle()
. In such way command will be more extensible. I can extend and rewrite only one method to get contents from another sources.
And does your comment touch custom properties
for checks in file too?
Default checks.
I don't understand what you are proposing
I propose to integrate more checks out of the box. Checks for redis
, checks for mongo
, for supervisor
/rabbitmq
etc, like as mysql
which is already in the package.
Can I create PR with moving getting hostsInFile to another method?
Ok
I propose to integrate more checks out of the box.
I don't want to maintain those. But those checks in a package of your own.