Emacs tip

Got tired of accidentally killing my scratch buffer.. this moves it to the back of the buffer list if you try to kill it.

 

(defadvice kill-buffer (around kill-buffer-around-advice activate)
    (let ((buffer-to-kill (ad-get-arg 0)))
        (if (equal buffer-to-kill "*scratch*")
            (bury-buffer)
          ad-do-it)))

How to make nagios default to showing all hosts on the status page

This was fun…. I wanted nagios to show me all my hosts instead of cutting things off at $annoying_limit.

My infrastructure isn’t crazy huge or this idea would be very bad.

So, after reading the source of status.c and cgiutils.c I eventually found my way into cgi.cfg

Here’s the solution. In cgi.cfg add this to the end of the file:

result_limit=0

That’s it. Reload nagios and you’re done.

In their defense, I did eventually find out that it was indeed mentioned in sample-config/cgi.cfg.in.

But there are so many options and only a very small codepath to the bit I cared about.

Future me, this is for you.