Showing posts with label fog machine. Show all posts
Showing posts with label fog machine. Show all posts

Sunday, 6 September 2009

Running an SNMP Agent on OS-X Leopard 10.5.x

I have been writing a awk script to parse SNMP data. The data would be collected using snmpbulkwalk, piped through the awk script and the output can be saved to a file or piped through some XML processor.

eg.
snmpbulkwalk -v2c -cpublic -OXf some.ip.address > machine.snmpwalk
snmpbulkwalk -v2c -cpublic -OXf some.ip.address | awk -f script.awk | xmllint --format - > machine.snmpwalk.xml
To test it I wanted an SNMP agent running on OS-X. I found this web page helpful so thought I would document my experience here.

Unix Alert

This post assumes that you understand most of the jargon and Unix commands that come with OS-X. I also use programs from the fink project.

Edit /etc/hostconfig

I used joe (from fink), but you could use nano or any other text editor.
  1. sudo joe /etc/hostconfig
  2. Change SNMPSERVER=-NO- to -YES-
NB: I haven't rebooted yet so I don't know if the SNMP agent starts automatically. For me this is not important since I am only testing and not wanting the actually collect SNMP data.
# This file is going away

AFPSERVER=-NO-
AUTHSERVER=-NO-
AUTOMOUNT=-YES-
NFSLOCKS=-AUTOMATIC-
NISDOMAIN=-NO-
TIMESYNC=-YES-
QTSSERVER=-NO-
WEBSERVER=-NO-
SMBSERVER=-NO-
SNMPSERVER=-YES-

Edit /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist

To make the SNMP agent start at boot time I found this post which explains that you need to edit /System/Library/LaunchDaemons/org.net-snmp.snmpd.plist and to change the element following the Disabled key from true to false.
<key>Disabled</key>
<false/>
Creating the SNMP Agent Configuration Files

You could do it manually, but why would you?
sudo /usr/bin/snmpconf -i
Notes
  • It asked me to merge in an existing file in /etc/snmp/snmpd.conf which I did.
  • I only created the snmpd.conf file.
  • I only changed the Access Control Setup (but you could do this manually if you prefer).
  • I later manually edited the file to change the location and contact details.

Here is a shortened log:
fox:pc-snmp2xml phil$ sudo /usr/bin/snmpconf -i

The following installed configuration files were found:

1: /etc/snmp/snmpd.conf

Would you like me to read them in? Their content will be merged with the
output files created by this session.

Valid answer examples: "all", "none","3","1,2,5"

Read in which (default = all):

I can create the following types of configuration files for you.
Select the file type you wish to create:
(you can create more than one as you run this program)

1: snmpd.conf
2: snmptrapd.conf
3: snmp.conf

Other options: quit

Select File: 1

The configuration information which can be put into snmpd.conf is divided
into sections. Select a configuration section for snmpd.conf
that you wish to create:

1: Access Control Setup
2: Extending the Agent
3: Monitor Various Aspects of the Running Host
4: Agent Operating Mode
5: System Information Setup
6: Trap Destinations

Other options: finished

Select section: 1

Section: Access Control Setup
Description:
This section defines who is allowed to talk to your running
snmp agent.

Select from:

1: a SNMPv3 read-write user
2: a SNMPv3 read-only user
3: a SNMPv1/SNMPv2c read-only access community name
4: a SNMPv1/SNMPv2c read-write access community name

Other options: finished, list

Select section: 3

Configuring: rocommunity
Description:
a SNMPv1/SNMPv2c read-only access community name
arguments: community [default|hostname|network/bits] [oid]

The community name to add read-only access for: public
The hostname or network address to accept this community name from [RETURN for all]:
The OID that this community should be restricted to [RETURN for no-restriction]:

Finished Output: rocommunity public

Section: Access Control Setup
Description:
This section defines who is allowed to talk to your running
snmp agent.

Select from:

1: a SNMPv3 read-write user
2: a SNMPv3 read-only user
3: a SNMPv1/SNMPv2c read-only access community name
4: a SNMPv1/SNMPv2c read-write access community name

Other options: finished, list

Select section: finished

The configuration information which can be put into snmpd.conf is divided
into sections. Select a configuration section for snmpd.conf
that you wish to create:

1: Access Control Setup
2: Extending the Agent
3: Monitor Various Aspects of the Running Host
4: Agent Operating Mode
5: System Information Setup
6: Trap Destinations

Other options: finished

Select section: finished

I can create the following types of configuration files for you.
Select the file type you wish to create:
(you can create more than one as you run this program)

1: snmpd.conf
2: snmptrapd.conf
3: snmp.conf

Other options: quit

Select File: quit


The following files were created:

snmpd.conf installed in /usr/share/snmp
Manually Editing the SNMP Agent Configuration File

I used joe (from fink), but you could use nano or any other text editor.
sudo joe /usr/share/snmp/snmpd.conf
Starting the SNMP Agent

Note: This is also required to start the agent after a reboot.
sudo /usr/sbin/snmpd
Testing the SNMP Agent
snmpbulkwalk -v2c -cpublic 127.0.0.1
You should see something like this:
SNMPv2-MIB::sysDescr.0 = STRING: Darwin fox.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.255
DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (173086) 0:28:50.86
SNMPv2-MIB::sysContact.0 = STRING: bill
SNMPv2-MIB::sysName.0 = STRING: fox.local
SNMPv2-MIB::sysLocation.0 = STRING: Redmond

SNMP to XML

In a later post, I will publish my SNMP to XML script.

UPDATE: Instead of doing this, I started an Open Source project which can be found here.

Saturday, 29 August 2009

Apache Tomcat 5.5 Installation on Mac OS-X Leopard 10.5.x


I needed to get Apache Tomcat 5.5 running on my Mac to experiment with Orbeon.

This was the most helpful information that I found, but I needed some extra steps.

1. Download Apache Tomcat 5.5 from here. Use the zip file since, for some reason, the README says that the tar shipped with OS-X is no good.

2. Move the downloaded zip file to where you want to unpack it. I choose my home directory which is /Users/phil

3. Open it and it should expand into a directory like /Users/phil/apache-tomcat-5.5.28

4. Browse to /Users/phil/apache-tomcat-5.5.28/bin

5. Open startup.sh with TextEdit.app

6. Add the following lines to the file after the EXECUTABLE line:
export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home
export CATALINA_HOME=/Users/phil/apache-tomcat-5.5.28

You will need to use the location where you placed the tomcat directory rather than mine.

7. I had to do three more things at this point to make all the shell (.sh) file executable.
1. Open Terminal.app
2. cd /Users/phil/apache-tomcat-5.5.28/bin
3. chmod u+x *.sh

8. Start tomcat this way:
./startup

I had another problem at this point. I already had an eXist server running on port 8080. eXist is included in Orbeon as well.

To change the port I needed to open /Users/phil/apache-tomcat-5.5.28/conf/server.xml and edit the line containing
Connector port="8080" maxHttpHeaderSize="8192
I changed the 8080 to 8180. You can choose almost any other port if that suits you situation better.

I still couldn't get tomcat to run. I found that it was already running so I had to kill it and then restart it.

I used the following command in Terminal to locate the program:
ps | grep tomcat
This generated the following lines. Ignore the 'grep tomcat' one and note the number of the second line - the 838 in my case.
3821 ttys000 0:00.00 grep tomcat
838 ttys007 0:10.71 /System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/bin/java -Djava.util.logging.config.file=/Users/phil/apache-tomcat-5.5.28/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/Users/phil/apache-tomcat-5.5.28/common/endorsed -classpath /Users/phil/apache-tomcat-5.5.28/bin/bootstrap.jar -Dcatalina.base=/Users/phil/apache-tomcat-5.5.28 -Dcatalina.home=/Users/phil/apache-tomcat-5.5.28 -Djava.io.tmpdir=/Users/phil/apache-tomcat-5.5.28/temp org.apache.catalina.startup.Bootstrap start
Now I had to kill the server with this command:
kill 838
Now I could restart tomcat and see the default home page.

I then pointed my browser to http://localhost:8180 and the default page was displayed.

Sunday, 13 July 2008

Fog Machine

This is one of those Now-what-am-I-going-to-do-with-it problems.

I picked up a box with a fog machine (Antari F-160) and fog fluid in it from a recent council clean-up. Since it was being thrown out I doubted that it would work. And it didn't.

Apart from a blown fuse, the fog machine heated up but the fluid pump would not work. The pump would hum when power (240VAC) was applied but it would not pump so I decided it was seized and set to dismantling it in order to clean it.

There didn't appear to be anything wrong. Nothing was blocked, it was clean and no part seemed damaged. If I loosely assembled the pump it would work, but if it was tightly assembled the pump would just hum.

I decided that someone on the net would be able to verify that I was assembling it correctly. I searched for the part number "SP-12A" and "Fog" and I came across this page which had a link to a picture showing the order of the parts.

In my pump, the washer/seal (part 5) was in a different place. I corrected my assembly and it worked nicely. With this seal (perhaps it is a spacer) in the wrong place, a little orange seal is compressed too much and grips the piston so tightly that it no longer can move and the pump can only hum. With the seal in the correct place, the piston moves freely and all is well.

The machine uses a remote control to turn the heater on and it has a switch to operate the pump. It was clear that the remote control cable was damaged so I repaired it, but the pump would not operate when the switch was depressed. I found that the remote control socket had 3 broken solder joints which I repaired.

The fog machine now worked.

Apart from entertaining the kids, what can you do with a fog machine?
  • Fill the house with fog and run a fire drill (get down low and Go Go Go!)
  • Check for air conditioner ducting leaks (but I don't have air conditioning)
  • Look for drafts around doors and windows
  • Cool party feature
  • Find exhaust leaks?
Maybe someone else has some thoughts.