Saturday, 19 Apr 2008nagios on Mac OS XNeeded to get LibGD, from , as mentioned in output from ./configure in the nagios source. So next I don't really know how to reload the new libraries and include files. Linux uses ldconfig, but Mac OS X uses dyld as I learned and was reading about on apple's discussions∞. But anyway, Nagios didn't make properly, even though libgd was noted as non-essential. (I tried to tell the nagios configure script about it with ./configure --with-gd-lib /usr/local/lib --with-gd-inc /usr/local/include, but it was no help, dyld needs to know somehow. But regardless, make-ing nagios was strange too, gcc was being called with -Iyes, including the directory "yes" to look for extra header files, but there is no such directory in the nagios source. I think the answer is somewhere in the Makefile. References to yes were made all through the output in the attempt to make nagios. Yes, the line CFLAGS=-g -O2 -Iyes -DHAVE_CONFIG_H -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -DNSCORE is in the Makefile and I was tempted to just remove this -Iyes, because it was just so strange. But I'm realizing that okay, that the Makefile was generated, so the problem is with the configure script. Okay, I was reading the configure script and saw that it actually expects those flags to get their arguments slightly differently: ./configure --with-gd-lib=/usr/local/lib --with-gd-inc=/usr/local/include , with equals signs. So now those libgd libraries still can't be found, but at least nagios makes properly now. I next used make install, but there are a few other installation commands. make install-init will put a start up script into /etc/rc.d/init.d, but Mac OS X treats startup scripts differently. Everything should work without this anyway. Next make install-commandmode created a directory /usr/local/nagios/var/rw with 775 permissions and enabled set user id for that directory. But now nagios wants to create a new account for the web interface, in my local apache, but Mac OS X doesn't have its httpd.conf at /etc/httpd/conf.d/ as they expect. They want to execute /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/conf.d/nagios.conf , so maybe I'll just change this to /usr/bin/install -c -m 644 sample-config/httpd.conf /etc/httpd/nagios.conf. Okay, that's where it went now. launchd I was also trying to follow http://aplawrence.com/foo-mac/launchd.html∞ and http://developer.apple.com/macosx/launchd.html∞ and I added the nagios startup script included in the source in a Mac OS X launchd way. So I added the daemon, daemon-init to a new directory /etc/rc.d/init.d/nagios , and I made a new xml job file , /Library/LaunchDaemons/nagios.plist. In it, I've got <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
I think it should start up automatically now, but I've started it up using launchctl load localhost.etc.initd.rcd.nagios and launchctl start localhost.etc.initd.rcd.nagios. But I think I'm going to add a <key>Disabled</key> <true/> line to the plist, because Nagios is freaking loud. I don't know what it's doing right now, but it's been taking up 99% of one of my cores. "http://www.apple.com/DTDs/PropertyList-1.0.dtd"∞> <plist version="1.0"> <dict> <key>Label</key> <string>localhost.etc.initd.rcd.nagios</string> <key>ProgramArguments</key> <array> <string>/etc/rc.d/init.d/nagios/daemon-init</string> <string>start</string> </array> <key>RunAtLoad</key> <true/> </dict> </plist> dirty nagios web setup I know there are Aliases in my /etc/httpd/httpd.conf to the nagios web stuff and to its cgi-bin, but I think I didn't put those aliases in the right place. OK, so I've got an Apache problem and not a Nagios problem. This is what I wrote before I realized the Aliases should be working.. The nagios quick start guide assumes that the http://localhost/nagios∞ link's going to work right away. I don't know why. Either I did something wrong, or it's really as I see it. The entry in the Makefile to do something with apache just creates some suggested nagios config file with a context for the nagios apache user permissions in /etc/httpd, but there's nothing that points to the nagios web files at /user/local/nagios/share. So Mac OS X is strange and all and it puts its web files at Library/WebServer/Documents/. Anyway, so I made a link to the web files with ln -s /usr/local/nagios/share /Library/WebServer/Documents/nagios and that seems to have worked. But it's very dirty, because I wasn't asked for a username as I hoped. So something has to be fixed. For some reason, the whole cgi-bin directory is missing from /usr/local/nagios/share/. So I don't know what's going on, so I just copy all the cgi files from the nagios source to a brand new cgi-bin. I try to stay consistent with the file permissions and the nagios:nagios owner:group. Now I can see those pages from Firefox, but permission is still denied. cgi's I still don't understand what to do. I noticed there was another make option, make install-cgis in the nagios source. I did that, but there's still no cgi-bin in the share directory . I even ran the full install . Anyway, now I know I have Aliases that should be working. I wonder if I resolve my Apache Aliases problem, will the permissions work? Some good stuff here∞ maybe. I'll try this later. Monday, 17 Mar 2008bash programming: different ways of dealing with filesMy main goal is to move some lines from a file based on the values of different space/tab separated fields on each line. Each line looks like: num1 num2 num3 num4. I want the line if num2=4 for example. grep is usually perfect for this, but its regular expression handling is poor. I learned about a new way of reading in files line by line: 11 while read line; 12 do 13 arr=`echo "$line" | cut -f 2` # look at the arrival time, the 2nd field 14 15 if [ $arr = $time ]; 16 then echo $line > ready.queue 17 fi 18 done < file Saturday, 15 Mar 2008getting LaTeX to work on Mac OS Xhttp://www.esm.psu.edu/mac-tex/start.html∞ seems to have a decent listing of the different LaTeX distributions out there and recommendations for dvi and ps viewers too. There's a lot of information about GUI editors which I was trying to avoid. My goal is to reproduce what I had setup in FreeBSD: one shot command line way of changing a .tex file to a .dvi file ( tex-to-dvi ), a dvi viewer, a dvi-to-pdf one shot command line method and of course a pdf viewer. Maybe tetex from macports will have what I want. It's the first I'll try. Build Dependencies: gawk, gsed Library Dependencies: XFree86 Runtime Dependencies: ghostscript, texinfo, texi2html After getting all the necessary dependencies, tetex installed easily. I did have to get a specific version of ghostscript from sourceforge, because grouchy macports was complaining about a bad md5. I just put it into /opt/local/var/macports/distfiles/ in place of the bad one and I was on my way. This is the equivalent of /var/ports/distfiles I guess. LaTeX works great so far. The distribution details: pdfeTeX 3.141592-1.21a-2.2 (Web2C 7.5.4) kpathsea version 3.5.4 Copyright (C) 1997-2004 Peter Breitenlohner (eTeX)/Han The Thanh (pdfTeX). Wednesday, 05 Mar 2008ssh into mac os x without leaving holesMake sure permissions to /etc/ssh_host_rsa_key, /etc/ssh_host_key and /etc/ssh_host_dsa_key are good. Friday, 04 Jan 2008Virtual Hosts on ApacheLooking at http://www.debianadmin.com/creating-name-based-and-ip-based-virtual-hosts-in-apache.html∞ so far. Virtual hosting or something similar was used in both of the last UCSB CTFs to represent multiple websites. the debian source says Apache has name based and ip based virtual hosting, but the UCSB images used different ports on the same ip address. I'm still looking for the distinction in setting this up. To set multiple sites on different ports, you can also use VirtualHosts, keep site http://www.kernelthread.com/mac/osx/tools.html∞ Wednesday, 28 Nov 2007X 11R6 on Mac OS XI don't know what drivers Aqua uses within Mac OS X to communicate with the video card, but there's a way available to use XDarwin, the Darwin implementation of XFree86, either along with Aqua the interface or as a replacement. XDarwin sits here: http://www.xdarwin.org/∞ ( really slow page right now). I suppose that the main reason why X support is useful on a mac is because there's an available API to XFree86 that can be used to talk to video drivers in a way that's standardized on most major unix type systems. This has almost boundless usefulness, because it actually places Mac OS X within that same standard, making graphical applications more easily portable to it. I suppose binaries to XDarwin are here: ftp://ftp.xfree86.org/pub/XFree86/4.4.0/binaries/Darwin-ppc-6.x/∞ . Hmm it's not working right now. Actually XDarwin might not be free. Wednesday, 14 Nov 2007How to enable core dumps on Mac OS X 10.4following this 'Technote' http://developer.apple.com/technotes/tn2004/tn2124.html#SECCOREDUMPS∞ Need to add the line limit core unlimited to the /etc/launchd.conf file. There's also a launchd.conf man page. Monday, 12 Nov 2007More on Apache on Mac OS X, how to get php to runThis requires starting up the correct modules in /etc/httpd/httpd.conf. A line in the conf refers me to http://httpd.apache.org/docs/dso.html∞ . httpd -l tells me my only "compiled in" modules are http_core.c and mod_so.c. Well I noticed (following oreilly's site∞ ), that my cgi module is loaded and added, but mod_perl and mod_php aren't. I also noticed I don't have any cgi test scripts in /Library/WebServer/CGI-Executables/. But anyway, I read that this is sort of a 'bin' directory, but if you have a # AddHandler cgi-script .cgi line in your httpd.conf, all .cgi and .pl files will be executed. I don't see that happening for me yet, but I did notice I can execute a perl script if I put it in the cgi-bin, actually. Php scripts still don't though. I uncommented lines according to this other site∞: #LoadModule php4_module #AddModule mod_php4.c #AddType application/x-httpd-php .php #AddType application/x-httpd-php-source .phps I expected the first two, but not the second two. However, they were already uncommented. Ok great, I restarted apache and now php works. Now I can get php to respond to ajax instead of just using just static xml files w/ ajax. Wednesday, 31 Oct 2007getting Apache 1.3 to allow perl script to run on Apache on Mac OS XI found this site∞ covers a lot of what I think should let perl run, but I still couldn't get it to run afterwards. The key apparently is to make several changes to the configuration file, vim /etc/httpd/httpd.conf. According to oreilly's site∞, the default server page is in /Library/WebServer/Documents/ on Mac OS X. That's a really strange place for it. Users' pages are at /Users/--user--/Sites/. Oct 2007ports tree mechanismhttp://www.oreillynet.com/mac/blog/2003/04/mac_os_x_unix_package_manageme.html∞ Darwin http://www.opendarwin.org/projects/darwinports/∞ documentation http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/index.html#//apple_ref/doc/uid/TP30001003∞ getting X11 functionality http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/index.html#//apple_ref/doc/uid/TP30001003∞ packages in /Library/Receipts some optimization from IBM with XL c/c http://publib.boulder.ibm.com/infocenter/macxhelp/v6v81/index.jsp?topic=/com.ibm.vacpp6m.doc/getstart/overview/overview.htm∞ |