spatie/laravel-server-monitor

Running checks modifies ALL checks to the type of the last

Closed this issue · 2 comments

I've defined a diskspace check which extends the Diskspace class (i've named it diskspace-windows). Since a connection to a Windows server is different than a linux server, i've also created an extended Manipulator class which changes the command if the type is 'diskspace-windows' (i mention this since it might be related).

After I run all the checks, ALL records have their type column changed to diskspace-windows.

Now, I could of course peruse all the code to see where the record is fetched incorrectly or such, but let me suffice to say that it might be a very poor design decision to modify the check record so it can contain the results of the last check.

Not only do you miss all history of checks but now all my checks have been changed to the type of the last.

In my view you create hosts and checks and then you have a separate table for the results. You could easily make it so it only holds the last successful result and the last x failures/warnings...

Aside from this: the code should NOT modify all records. Period.

Frankly, I don't have that much time to spend on this project, but i'm willing to run some tests and share some code. Please advise which route to take.

OMG! Sorry!

My colleague pointed out that I made a type where I changed a == to an =; effectively setting the check type every time.

That led to the check being overwritten with a different type.

However, this could only have happened when the results of the check are saved in the same table as the checks themselves. Which I still believe to be a poor design decision.

;-)

I'd accept simple backwards compatible, fully tested PRs that can improve the package.