Configure MS Windows 7 SNMP to work with SpeedFan

Hello m8s,

As you know in system administration field , the monitoring is essentials part daily stuff.

In Linux based OS , if you need to extract some numerical values from main-board sensors you will accomplished with no-more than….5 click..i mean commands.
And everything will just work as you expect…but there is also other side – some call it Windows ūüėÄ

As you know, running stuff on Windows sometimes becomes so fantastic journey (with point of no return ^_^), that you just may not able to remember where you start…and how the hell you made the deam thing to work ūüôā

In next..not so few steps i will show you how drawing thought SNMP numerical values from your main-board sensors.

I will use windows SNMP services + Speed Fan + all of my knowledge do guide you.

Installing and config snmp sensors with Windows 7

– Navigate to “Control Panel” -> “Programs and Features

– In left part select “Turn Windows features on or off

– Search in “Windows Features” for “Simple Network Managment Protocol (SNMP)” -> and put check . Now wait until install complete

– Navigate to services control pannel: Start Menu -> Run -> services.msc than search for “SNMP Services and righ click – Properties.

– Select “Agents” tab and type the correct values in Name and Location. For example: “Pavlin.Chervenkov” “Floor2” and then hit apply

– Select “Traps” tabs and type in “Community name” type “desktop” then hit apply.

– Select “Security” tab and add to “Accepted community names” the name from previous step – “desktop” and “Community rights” (READ ONLY)

– Add desire host to “Accept SNMP packets from these hosts” or use “Accept SNMP packets from any host

Then Apply and OK

– It is a MUST to stopl services and put it on Manual mode ! We shall start it later

– Check windows firewall !

 

Speedfan + snmp extension

–¬†Install¬† installspeedfan439.exe

– Install speedfan snmp extension http://deve.loping.net/projects/sfsnmp/downloads/

РStart speedfan with full path like this: Start > Run > C:\Program Files (x86)\SpeedFan\Injector.exe

 

Windows fixs

Control Panel¬†>¬†All Control Panel Items¬†>¬†User Accounts¬†>¬†Change user account control settings –¬†Never notify

Go to speedfan folder: C:\Program Files (x86)\SpeedFan\ 

right click on¬†injector.exe¬†>¬†Properties¬†>¬†Compatabillity¬†>¬†Set checkbox ON ¬†“Run this program as an administrator

Task Scheduler

We have to create two scheduler task to run everything smoothl.

1. Speedfan

Start > Run amd type: %windir%\system32\taskschd.msc /s

Action > Create Taks

General:

Name: speedfan

Configure for: Windows 7

Triggers > New:

Begin the task: At log on

Delay task for: 30 seconds

Actions > New:

Start a program:

“C:\Program Files (x86)\SpeedFan\injector.exe”

2. SNMP Task

Action > Create Taks

General:

Name: snmp

Configure for: Windows 7

Triggers > New:

Begin the task: At log on

Delay task for: 1minute

Actions > New:

Start a program:

D:\Install\snmpstart.bat”

This is content of snmpstart.bat

“net start snmp” <- Without the quotes !

Speedfan settings

 

Rum Smart fan from above path for the first time:

Start > Run: C:\Program Files (x86)\SpeedFan\injector.exe

Select “Configure” then “Options

+ “Start minimized”

+ “Minimize on close”

That is ! Now restart and pray.

I hope that you will enjoying doing this…:)

 

How to create software RAID 1 from existing installation on live system

If you have already installation which is installed on disk drive (/dev/sda), which is not part of RAID array and you have second disk drive (/dev/sdb) which is not in usage and you want to create software RAID from existing installation while OS is working, you can do following task to accomplish this:

1. Create RAID partitions on the second disk drive:
fdisk -l /dev/sdb

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1        2432    19535008+  fd  Linux raid autodetect
/dev/sdb2            2433        2918     3903795   fd  Linux raid autodetect
/dev/sdb3            2919        3404     3903795   fd  Linux raid autodetect
/dev/sdb4            3405      121601   949417402+  fd  Linux raid autodetect
Create RAID 1 arrays using only the second disk and only one device per RAID partition.
mdadm --create /dev/md0 --level=1 --raid-devices=1 /dev/sdb1 --force
mdadm --create /dev/md1 --level=1 --raid-devices=1 /dev/sdb2 --force
mdadm --create /dev/md2 --level=1 --raid-devices=1 /dev/sdb3 --force
mdadm --create /dev/md3 --level=1 --raid-devices=1 /dev/sdb4 --force
Create swap and file systems:
mkfs.ext4 /dev/md0
mkfs.ext4 /dev/md2
mkfs.ext4 /dev/md3
mkswap /dev/md1
Mount and synchronize the existing data to RAID arrays:
mkdir /mnt/tmp
mkdir /mnt/var
mount /dev/md0 /mnt
mount /dev/md1 /mnt/tmp
mount /dev/md2 /mnt/var
mkdir /mnt/sys
mkdir /mnt/proc
rsync -av --exclude="/mnt" --exclude="/proc" --exclude="/sys" / /mnt/
rsync -av /var/ /mnt/var/
rsync -av /tmp /mnt/tmp/
Install grub to the new disk which implements RAID arrays:
grub-install /dev/sdb --root-directory=/mnt/
Update grub config files:
mount --bind /proc /mnt/proc
mount --bind /sys /mnt/sys
chroot /mnt
update-grub
exit
Describe the new mount devices in ‘/mnt/etc/fstab’:
~# blkid /dev/md0 
/dev/md0: UUID="64ea9000-3df6-4699-8c2e-df48f5c3835e" TYPE="ext4" 
~# blkid /dev/md1
/dev/md1: UUID="133dabc7-7957-462e-8b5e-1594ded31ec8" TYPE="swap" 
~# blkid /dev/md2
/dev/md2: UUID="a65dcd80-b8fc-49a6-835f-b06b930824b7" TYPE="ext4" 
~# blkid /dev/md3
/dev/md3: UUID="a7cbbd28-0617-4013-9870-714cf75334f4" TYPE="ext4"

cat /mnt/etc/fstab 
# /etc/fstab: static file system information.
#
# &lt;file system&gt; &lt;mount point&gt;   &lt;type&gt;  &lt;options&gt;       &lt;dump&gt;  &lt;pass&gt;
proc	/proc	proc	defaults	0	0
UUID=64ea9000-3df6-4699-8c2e-df48f5c3835e	/	ext4	defaults,errors=remount-ro	0	1
UUID=133dabc7-7957-462e-8b5e-1594ded31ec8	none	swap	sw	0	0
UUID=a65dcd80-b8fc-49a6-835f-b06b930824b7	/tmp	ext4	nodev,nosuid	0	2
UUID=a7cbbd28-0617-4013-9870-714cf75334f4	/var	ext4	defaults	0	2
Umount RAID partitions:
umount /mnt/proc
umount /mnt/sys
umount /mnt
Reboot the server and choose from the BIOS to boot from the second disk drive
After starting server again you should see already RAID arrays mounted devices:
mount
/dev/md0 on / type ext4 (rw,errors=remount-ro)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/md2 on /tmp type ext4 (rw,nosuid,nodev)
/dev/md3 on /var type ext4 (rw)
We need to mirror partition table from the new RAID block device to the old (/first) disk drive:
sfdisk -d /dev/sdb | sfdisk /dev/sda
Grow RAID arrays size:
mdadm --grow --raid-devices=2 /dev/md0
mdadm --grow --raid-devices=2 /dev/md1
mdadm --grow --raid-devices=2 /dev/md2
mdadm --grow --raid-devices=2 /dev/md3
Add partitions from the first disk to RAID arrays:
mdadm --manage /dev/md0 --add /dev/sda1
mdadm --manage /dev/md1 --add /dev/sda2
mdadm --manage /dev/md2 --add /dev/sda3
mdadm --manage /dev/md3 --add /dev/sda4
Now the new disk arrays should start syncing:
cat /proc/mdstat 
Personalities : [multipath] [faulty] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [linear] 
md0 : active raid1 sda1[2] sdb1[0]
      19533912 blocks super 1.2 [2/2] [UU]

md1 : active raid1 sda2[2] sdb2[0]
      3902759 blocks super 1.2 [2/2] [UU]

md2 : active raid1 sda3[2] sdb3[0]
      3902759 blocks super 1.2 [2/1] [U_]
      	resync=DELAYED

md3 : active raid1 sda4[2] sdb4[0]
      949416242 blocks super 1.2 [2/1] [U_]
      [==================&gt;..]  recovery = 91.0% (864771072/949416242) finish=21.4min speed=65886K/sec
At the end we need to install grub on the first disk (/dev/sda) so if we can boot from any of disk:
grub-install --recheck /dev/sda

So this way you can create RAID 1 without almost any downtime. Just one server’s reboot and changing drive boot priority.

Inteligante apache/nginx log analyzer.

Howdy m8s.

In next article i want to show you how to make an easy statistical view for an web page only by using one simple tool called goaccess.

http://goaccess.prosoftcorp.com/

As they say to their site, this tool can provide a various information for your web site just by scanning log files from apache / nginx logs.

 -General Statistics, Bandwidth etc.
 -Top Visitors
 -Requested files
 -Requested static files, images, swf, js, etc.
 -Referrers URLs
 -404 or Not Found
 -Operating Systems
 -Browsers and Spiders
 -Hosts, Reverse DNS, IP Location
 -HTTP Status Codes
 -Referring Sites
 -Unlimited log file size

For this review i’ll use VirtualBox image with Debian wheezey net-install with xfce.

Install methods:

1. debian package manager installer

If you install goaccess via debian wheezy installer it will put all packages needed for that tool and it will be ready for use.
But in that way you can’t use utf8 or geoip support.

sudo aptitude install goaccess

and you will have Version: 0.5-1

If you dont really need utf8/geoip the install part for you end with this simple command.

2. Manually compile

Here we shall install goaccess tool with fully support of utf8/geoip

Download it to your work dir..in my case this is /root/Downloads/

you need to install this libs

libglib2.0-dev libgeoip-dev  libncursesw5-dev libncurses5-dev

Than you have to follow the exact instructions from the site:

wget http://downloads.sourceforge.net/project/goaccess/0.6/goaccess-0.6.tar.gz
tar -xzvf goaccess-0.6.tar.gz
cd goaccess-0.6/
./configure --enable-geoip --enable-utf8 
make
make install

After compile is done you can use it on the fly by typing

goaccess -f /var/log/apache2/access.log -a -c

the “-c” options if for log/date configuration window.
In this window to show correctly apache log files you need to choose “NCSA Combined Log Format”

And this is all…now in console you can see in real time how log statistics is changing ūüôā

Goaccess main window