Jun 182015
 

I recently had to verify a whole bunch of servers were responding to SNMP and had the correct DNS reverse look ups in Active Directory.
I used this little script so that it would ask me for an IP address and then do a ping, and then if a server was reachable over ICMP, a nslookup if a server responded to the SNMP Query for the system name.
Continue reading »

Share
Jun 152015
 

I recently found out that Telstra has a SMS API, and for now, it’s free to use for up to 1000 SMSes a month for Australians (sorry rest of the world).

As I’ve been building up Zabbix for our work environment where SMSes are used regularly to alert techs to critical alerts, this piqued my interest as this means that for now, I could have SMS alerts for my homelab, and potentially implement the same solution at work.
Continue reading »

Share
May 212015
 

One of the reason why I bought the IP camera in the first place was to replace a USB webcam that I was using to do some motion detection. The camera was plugged into a virtual machine and wasn’t very reliable so when I saw the IP Camera, it crossed my mind that it would be a nice cheap replacement for the webcam.

The first thing I needed to to do was configure the username and password on the IP Camera itself. This is to ensure that no one can log in to the webcam from the cloud service.

Configuring the IP Camera

I will be doing any setup for the IP Camera on the web interface as it’s a platform agnostic way of setting it up.
Log in to the camera by directing your browser to http://:99/ and entering your password.
The default credentials are “Admin” with a blank password.

Click on sign in on one of the modes, I’ve used the Chrome mode.
Menu

Click on the settings button in the bottom right hand corner, and then click on Users Settings in the right hand menu.
settings button
If you want to, you can change the name of the admin user here, I’ve set a password for my admin user here.
Click on Submit. The IP Camera will now reboot for the settings to take effect.

Configuring Motion

I’ll be using Motion for more than one device so I will configure it using separate configuration files for the camera in preparation for other cameras to also be added in. It’s possible to use a single configuration file if you want, but if there is a possibility of adding more cameras later on, it would be easier to start with multiple configuration files off the bat.

Configuring the Motion Daemon

There’s a few settings that I’ll be changing from the default Motion configuration.
First thing you should change is the line in /etc/default/motion. Change it to read from no to yes.

Next, we’ll have a look at motion.conf.
The following lines in there that I will be commenting out so that Motion doesn’t look for a local device. It’s possible that you don’t need to comment these line;s out, but I prefer to be thorough to ensure nothing unexpected happens.
videodevice /dev/video0
v4l2_palette 17
input -1
norm 0

There’s also a few lines you’ll need to update.
There are a couple of lines that set the resolution. By default, they are at 320 and 240.

width 320
height 240

Update these 2 lines to 640 and 480 like so

width 640
height 480

I’m also going to up the framerate from framerate 2 to framerate 30 to get some smoother video, Keep in mind that this is just a maximum framerate.

We’ll update the server options next so that you can access the control panel from another computer on the network.
There is a couple of lines like this –

stream_localhost on
webcontrol_localhost on

These needs to be changed to off like so –
stream_localhost off
webcontrol_localhost off

At the bottom of the configuration file, you will see some thread lines. We’ll need to uncomment one so we can put the settings for our first camera into one of the files.
From

; thread /etc/motion/thread1.conf

To

thread /etc/motion/thread1.conf

thread1.conf

If you’re only intending to use one camera then you don’t need to create this file, you’ll just need to do the following in the main motion.conf file.

In this file, we’ll need to set the URL for the camera itself.
Put this into a new file named /etc/motion/thread1.conf

netcam_url http://192.168.2.16:99/videostream.cgi?user="YOUR ADMIN USER HERE"&pwd="YOUR ADMIN PASSWORD HERE"

Replace the username and password with your own.
Save the file, and then you should be able to start motion with /etc/init.d/motion start
Then, using a player like VLC and browsing to the address of the computer running motion on port 8081 should get you a stream of the IP Camera.

Share
Apr 162015
 

I’ve been setting up SNMP Traps on Zabbix 2.4 to replace our current in place monitoring solution.
One of the hurdles that I’ve come across is trying to get all the traps setup.

An easy way of doing this is getting the MIB files for the traps that you’re getting, and converting them into configuration files for SNMPTT to use to parse the traps.
The snmpttconvertmib command will take a MIB file as an input, and spit out a configuration file suitable for SNMPTT.
Using an Oracle MIB file as an example –

snmpttconvertmib --in=ORACLE-ENTERPRISE-MANAGER-4-MIB.mib --out=/etc/snmp/snmptt.conf.ora-em4

This will produce a file for SNMPTT but Zabbix will not parse the traps yet as the FORMAT line isn’t quite what we need yet.
Next, we’ll use sed to do a global search and replace to make sure the FORMAT lines conform to the format that Zabbix requires.

sed -i 's/FORMAT/FORMAT ZBXTRAP $aA/g' /etc/snmp/snmptt.conf.ora-em4

The configuration file then needs to be added to the list of files that SNMPTT uses to parse the traps.
Open /etc/snmp/snmptt.ini file – assuming it’s in the default location – and scroll right down to the bottom of the file.
You will see the following lines –

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf

Add the file you’ve just created to the end like so –

snmptt_conf_files = <<END
/etc/snmp/snmptt.conf
/etc/snmp/snmptt.conf.ora-em4

And you should start getting SNMP traps appearing in Zabbix – assuming you’ve already set up the item.

Share
Dec 182013
 

In my recent FreeNAS blog post, I couldn’t access the FreeNAS web GUI with the Google Chrome Browser. Trying to access a page would present a 400 Bad Request - request header or cookie too large error.

After doing some research online, I found out that the way to solve this issue was to modify the nginx configuration to allow for large headers.

As this was FreeBSD, the configuration file for nginx was located at /etc/local/nginx/nginx.conf. In a Linux distribution, the file would likely be located in /etc/nginx/nginx.conf
In that file, we need to add this line within the server stanza.
large_client_header_buffers 4 16k;

I’ve modified my nginx.conf file so now it look like this –

<snip>
server {
server_name localhost;
listen 0.0.0.0:80;

large_client_header_buffers 4 16k;
<snip>

After modifying the configuration file, nginx needs to be restarted.
On FreeBSD, the command to restart nginx is /usr/local/etc/rc.d/nginx restart
On Linux, the command varies by distribution, but in general would be something like /etc/init.d/nginx restart

After restarting nginx, I was able to access the FreeNAS web interface with the Chrome Browser

Share