Skip to content

Commit

Permalink
Merge pull request opsschool#209 from mynamewastaken/master
Browse files Browse the repository at this point in the history
Added some text to cron/troubleshooting articles, fleshing out DHCP
  • Loading branch information
miketheman committed Apr 20, 2014
2 parents a37e5e9 + 18ba20e commit 5340ee0
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
11 changes: 10 additions & 1 deletion cron_101.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ Knowing this, we can see that this "crontab" means:
At 12:05 every Sunday, every month, regardless of the day of the month, run the
command ``copy-to-partition`` in the ``/home/jdoe/jobs`` directory.

**Caveat**: entries in your crontab must be one long line; if you try to split it up
(with the linebreak ``\`` character for example) you will get an error!

Let's take another example and create a cron job that checks disk space
available every minute, every hour, every day of the month, every month, for
every day of the week, and outputs it to a file named :file:``disk_space.txt``.
Expand Down Expand Up @@ -209,6 +212,8 @@ Notes on composing good "cron expressions"
variables that come from your shell initialization files (like ``.bashrc`` or
``.zshrc`` or such). In particular, make sure to specify the full path to your
program if it's not in a commonly-used location like ``/usr/bin``.
- If you have problems with the syntax, or something isn't working properly, there
are websites [#]_ that will translate crontab to English, and vice versa. [#]_

Modify a specific user's crontab
--------------------------------
Expand Down Expand Up @@ -241,4 +246,8 @@ Footnotes

.. [#] `"Examples" in cron - Wikipedia, a free encyclopedia <http://en.wikipedia.org/wiki/Cron#Examples_2>`_
.. [#] `Where can I set environment variables that crontab will use?, <http://stackoverflow.com/questions/2229825/where-can-i-set-environment-variables-that-crontab-will-use/10657111#10657111>`_
.. [#] `Crontab to plain English <http://cronchecker.net>`_
.. [#] `English to crontab <http://corntab.com/>`_
.. [#] `Where can I set environment variables that crontab will use? <http://stackoverflow.com/questions/2229825/where-can-i-set-environment-variables-that-crontab-will-use/10657111#10657111>`_
20 changes: 19 additions & 1 deletion dhcp.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
DHCP
****
DHCP, or, Dynamic Host Control Protocol is a standard that allows one central
source, i.e. a server or router, to automatically assign requesting hosts an IP
address.

The most common DHCP servers on Linux platforms are the ISC's
(Internet System Consortium) ``dhcpd``, and ``dnsmasq``. On Windows platforms
there are a variety of DHCP servers, though the Microsoft DHCP server is
arguably the best in terms of support and integration.


Tools: ISC dhcpd
================
``dhcpd`` is the most common DHCP server, and it offers excellent integration
with BIND (DNS server).

Protocol
========

dhcp helper
===========
DHCP helpers are sometimes referred to as DHCP relayers. The basic idea is that
a relay agent will forward DHCP requests to the appropriate server. This is
necessary because a host that comes online on a subnet with no DHCP server
has no way of finding the correct server; it needs a DHCP assigned address to
find a route to the correct DHCP server, but can't get there because it has no
IP address! DHCP relaying solves this chicken and egg problem by acting as an
intermediary. See this wikipedia [#]_ article for more details.

Defining classes, leases
========================
Expand All @@ -23,5 +41,5 @@ DNS server(s)
-------------
(Tie in previous chapters re: TFTP, PXE with related options?)


.. [#] `DHCP relaying explained <http://en.wikipedia.org/wiki/Dynamic_Host_Configuration_Protocol#DHCP_relaying>`_
28 changes: 25 additions & 3 deletions troubleshooting_101.rst
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ problem. Over time you will expand what is in your toolbelt, but to start with
you must know how to use each of these:

* ``top``, ``vmstat``, ``iostat``, ``systat``, ``sar``, ``mpstat``
These help you see the current state of the system - what is running, what is
using cpu, memory? Is the disk being heavily used? There is a lot of
help you see the current state of the system - what is running, what is
using cpu, memory? Is the disk being heavily used? There is a great deal of
information, and knowing how these tools work will help you pick out the bits
you should focus on.
* ``tcpdump``, ``ngrep``
Expand All @@ -49,7 +49,7 @@ Walk through of a diagnosis
* What changed recently?
* Could any of the symptoms be red herrings?

* Common culprits (is it plugged in?)
* Common culprits (is it plugged in? is it network accessible?)
* Look through your logs
* Communicating during an outage
* 'Talking Out-Loud' (IRC/GroupChat)
Expand All @@ -72,9 +72,31 @@ identify and fix them.
Cannot bind to socket
^^^^^^^^^^^^^^^^^^^^^

There are two common reasons that you can't bind to a socket: the port is
already in use, or you don't have permission.
As an example, you can see what happens when I try to start a Python
SimpleHTTPServer on a port that is already in use:

.. code-block:: console
user@opsschool ~$ python -m SimpleHTTPServer 8080
...
socket.error: [Errno 98] Address already in use
Here's an example of what happens when I try to bind to a privileged port
without proper permissions (in Linux, ports < 1024 are privileged):

.. code-block:: console
user@opsschool ~$ python -m SimpleHTTPServer 80
...
socket.error: [Errno 13] Permission denied
Permission denied reading to / writing from disk
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^



Out of disk space
^^^^^^^^^^^^^^^^^
(finding large files, and also finding deleted-but-open files)
Expand Down

0 comments on commit 5340ee0

Please sign in to comment.