Managing hosts

Adding hosts

You can add hosts by running:

php artisan server-monitor:add-host

You'll be prompted for the name of your host, the ssh user and the port that should be used to connect to the server and which checks it should run.

On most systems the authenticity of the host will be verified when connecting to it for the first time. To avoid problems while running the check we recommend manually opening up an ssh connection to the server you want to monitor to get past that check.

Although we don't recommend this, you could opt to disable the host authenticity check altogether. Be aware that this will leave yourself open to man in the middle attacks. If you want to go ahead with this option add -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no to the ssh_command_suffix key in the server-monitor config file.

Deleting hosts

Deleting hosts is a simple as running

php artisan server-monitor:delete-host <host-name>

where <host-name> is the name of the host you wish to delete.

Syncing from a file

If you have a large number of hosts that you wish to monitor using the server-monitor:add-host becomes tedious fast. Luckily there's also a command to bulk import hosts and check from a json file:

php artisan server-monitor:sync-file <path-to-file>

Here's an example of the structure that json file should have:

[
  {
    "name": "my-site.com",
    "ssh_user": "forge",
    "ip": "1.2.3.4",
    "checks": [
      "diskspace", "mysql"
    ]
  },
  {
    "name": "another-site.be",
    "ssh_user": "forge",
    "checks": [
      "diskspace"
    ]
  }
]

Manually modifying hosts and checks

Instead of using artisan commands you may opt to manually configure the hosts and checks in the database