![]() We’ll talk about how to connect to that web server a bit later. Only users who are logged in on your server will be able to log into the monit web interface. This means that on a server, you’re not actually opening up a port to all the the bored angry Internet People who would love nothing more than a chance to Break Your Things. What this means is “please run a nice little web interface on localhost port 2812, and only allow someone to see the monitoring data if they know this username and password.” Using the ‘localhost’ address means that only someone sitting on the local machine will be able to contact the web server and try logging in. Use address localhost # only accept connection from localhostĪllow somecleverusername:doodlywhumps_borfinschlumps43 # username:password The first line means “wake up and check all the things I’ve defined in this config file every 120 seconds, or two minutes.” The second line means “please log into a special logfile just for monit, as opposed to syslog.” Now the cool part: we’re going to ask monit to run a little web server on our localhost to give us a graphical interface to the monitoring data from this machine: set httpd The first lines of your config file will be something like this: set daemon 120 You’re going to define some things in this config file (monitrc) and every time Monit wakes up it goes through the list of things you told it to check, and alerts you if anything it sees anything wrong. Monit runs as a daemon (a background process that periodically wakes up, does some things, and then goes back to sleep). Sudo monit status # show some basic system information ![]() If all goes well, you can run monit and check what’s going on by typing: sudo monit # this will launch the monit daemon Here’s what the output of that command looks like if you don’t have a monitrc file in the right place: $ sudo monit -tĬannot find the control file at ~/.monitrc, /etc/monitrc, /etc/monit/monitrc, /usr/local/etc/monitrc or at. This will check the syntax of your configuration file to make sure there are no problems. ![]() You can double-check that monit can see your control file (configuration file) by typing sudo monit -t There are a few different places where you can keep your monitrc file. You do not want any other accounts capable of reading this file or doing things with monit, since it can start and stop services). On FreeBSD, this file was at /usr/local/etc/monitrc.sample, and I copied it over to /root/monitrc (and make absolutely sure that it has permissions of ‘600’ - owner read/write nothing for group or others. It will already exist if you just installed monit on Ubuntu: $ ls -alh /etc/monit/monitrc Next, you’ll want to make sure a monit config file exists - this file will be called ‘monitrc’. Make sure a config file exists (and will be found by monit) To get it installed (assuming Ubuntu, as always, because it’s what most of you have installed): $ sudo apt-get install monit I use it to monitor an Ubuntu machine, a few Debian VPSs, and several heavy pieces of metal running FreeBSD. You heard right - this thing runs on all the Linuxes and Unixes. Installing Monit for Linux/Unix System Monitoring In this post, I’ll take you from “no idea what’s happening on the server” to “closely monitoring critical services.” Follow along!
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |