Download the PHP package posixpascal/spark-alarm without Composer

On this page you can find all versions of the php package posixpascal/spark-alarm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package spark-alarm

🌩spark 🚨alarm

Build Status Latest Stable Version Total Downloads License Code Climate

Spark is a super simple monitoring tool with a very flexible architecture. You can create customized alarms which trigger on your behalf and send custom notifications. The implementation detail is minimalistic on purpose so that spark adapts to your platform.

It's designed to work as a CLI application as well as a regular shell script so you can add a cronjob which runs spark whenever you desire.

It's also compatible by the "cronjob tool" many cheap VPS hoster offer where you can only call remote PHP scripts by URL.

If you need custom server monitoring, custom notification and/or you're bound to a cheap VPS hoster – Spark is for you.

Installation

Install using composer:

Usage

Spark follows the concept of custom Alarm classes which consist of a simple test() method and optional error/success handlers. Once you have your own alarm class you can add it to the Spark Instance and run it.

Now add that script to your crontab file and you've added your first server monitoring tool.

Here is an alarm which checks if a certain website is reachable:

If you want to periodically check your alarms you can tell Spark to keep itself alive like this:

Now the script will periodically check your alarms and notice you if any condition fails. By default spark pauses for 5 minutes after each alarm was checked, you can change this delay by passing ->interval(<seconds>) to the spark instance.

At the end of each run spark will use a so called Notifier to inform you about the test results, per default the builtin Notifier only logs failed alarms to the console, but you can easily write your own notifier like the example below:

As mentioned before Spark does only pass failed alarms to the notifier, if you want to receive all alarms you can either set it globally like this:

or on individual alarms by setting sendNotificationOnSuccess to true:

If you are running checks using ->keepAlive you may not always want the notifier to send you summaries. You can set a minimum delay between notifiers as well using the ->throttle(<seconds>) method.

Using both throttle and interval you can keep checking your alarms and execute their error function in a given interval but only send notifications after said throttle.

I commonly use it like this:

Since you can access failed alarms in the notifier class you can build pretty summaries, for example you can not only inform the user that the CPU on server1 is above 95, you can also list the processes which consume the most CPU just by adding such a method to the alarm and calling it in the notifier.

Helpers

SparkAlarm is the base class for an alarm and includes many utility methods for getting system resources. These only work on Linux machines but are not necessarily required for your alarms to work. They include:

Why

For a personal project I needed reliable server monitoring and didn't want to pay for any current solutions. Most of the server monitoring tools on github include things like stats, DB setups, admin backends which are way to heavy for small personal websites.

Todo

There are many features I'd like to implement in the future but I don't personally invest much in this library. At the moment it's pretty barebone but I plan to add the following features if they are needed by other projects:

License

MIT


All versions of spark-alarm with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1.0
phpunit/phpunit Version 6.1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package posixpascal/spark-alarm contains the following files

Loading the files please wait ....