Get started with server monitoring
Monibot monitors your server's resource usage and performance metrics and notifies you if any of these are out of bounds.
- Resource usage (CPU/Mem/Disk) in percent.
- Load average, also called 'loadavg' in Linux.
- Clock diff: The difference between your server's clock and Monibot's clock.
- Disk activity: Read/write per hour/day.
- Network activity: Send/receive per hour/day.
Create a machine in Monibot
- Log into your Monibot account. If you don't have one, register now, it's free.
- In the main menu, click on the 'Machines' link. Here you'll see a 'New Machine' button.
- Click the 'New Machine' button. Enter a name for the machine. You can chose any name here, it's used only for display.
- Click 'Save'. Your machine is ready and will listen for data from your server. Please note that we've allocated a unique id for your machine. You will need that id in the next steps.
Install the moni
command line tool
The moni tool is a small, self-contained and easy-to-setup linux tool that collects usage metrics and sends them to Monibot. The tool is written in Go and it is open-source, so you can build it from source if you like. For convenience, we also provide pre-built binaries for linux/amd64. For download and build instructions follow this link: https://github.com/cvilsmeier/moni.
Send machine samples to Monibot
To send machine samples to Monibot, invoke moni
like so:
$ export MONIBOT_API_KEY=00000000000000000000000000000000
$ export MACHINE_ID=11111111111111111111111111111111
$ /path/to/moni sample $MACHINE_ID 5m
-
MONIBOT_API_KEY
. This is your API key. You can find it on your account profile. While you can set the API key directly in the invocation, it's a good practice to set it as an environment variable. -
MACHINE_ID
is the id of the machine you have created above. -
The interval
5m
tells moni to send a machine usage sample every five minutes.
This command does the following: It consults various Linux system services to get the current performance numbers, collects them, and uploads them to monibot. Then it waits five minutes and starts over.
Autostart at system boot
You'll probably want to start moni
automatically at system boot.
For this, the easiest way is a @reboot
crontab entry,
for example:
MONIBOT_API_KEY=00000000000000000000000000000000
MACHINE_ID=11111111111111111111111111111111
@reboot /path/to/moni sample $MACHINE_ID 5m &
Advanced options
Up until now, your server is sending server metrics to Monibot. You can now instruct Monibot to notify you when metrics go beyond limits. You can also send arbitrary text to Monibot.
Resource usage limits
You can instruct Monibot to notify you if any of your server's metrics go out of bounds:
- While short spikes in CPU usage are perfectly OK, a longer period of very high CPU usage (say, for example more than 75% for one hour) might indicate a problem.
- If the disk usage grows too large (say, for example 80%), there might be no longer enough space to make a nightly database backup.
- If the realtime clock of your server goes wrong (e.g. more than 10 seconds), this may indicate a problem of your NTP setup.
In these situations, you may want Monibot to notify you. Therefore, Monibot lets you set lower and upper limits for each usage metric. If a metric exceeds the limit, Monibot will notify you.
Text files
There are a number of things you might check regularly by ssh
'ing
into your server and checking manually:
ps aux
top -bn1
apt list --upgradable
uptime
lastlog
df -h
cat /proc/meminfo
...
With Monibot, you can write a shell script that runs arbitrary commands
(for example the commands shown above), and sends the outputs to Monibot.
There, you can check the outputs online.
This is especially helpful if you are running a number of servers: you no
longer have to ssh
into each server separately.
Instead, you can see everything at once from within your Monibot account.
Here is how it works:
#!/bin/sh
# run commands and collect outputs
OUT=out.txt
date >> $OUT
ps aux >> $OUT
lastlog >> $OUT
# send to monibot
MONIBOT_API_KEY=00000000000000000000000000000000
MACHINE_ID=11111111111111111111111111111111
/path/to/moni text $MACHINE_ID $OUT
# cleanup
rm $OUT
Now add this script to your hourly crontab. From then on, your script will run every hour and you can check the outputs directly in Monibot.
If you have a question that is not covered by our docs, please feel free to contact us, we are happy to help.