Varnish – tips trick #1

Here’s varnish tips trick number 1

How to check varnish rule? Create a file (ie: check-varnish.sh) with this content:

#!/bin/bash
varnishd -C -f /etc/varnish/default.vcl

How to check top domain on multi domain varnish configuration? Create a file (ie: check-top-domain.sh) with this content:

#!/bin/bash
varnishtop -i RxHeader -C -I ^Host

reverse proxy trick, varnishing tips and tricks, varnish vcl trick, varnish reverse proxy multiple domain, varnish reverse proxy configuration multi domain, varnish as proxy ubuntu, uc trick reverse proxy, ubuntu getty ttys0, trick reverse proxy proxy list, trick reverse proxy

Howto monitor ntp server with mrtg

I’m currently maintain several ntp servers that listed in ntppool.org.
Average of all ntp servers listed there, there must be monitoring using mrtg.
After a little searching and asking questions on the mailing list. Here’s my configuration:
———————getntp.pl———————

################################## 
#getntp.pl 
#source : http://www.satsignal.eu/ntp/NTPandMRTG.html 
#budiw 20120728
$ntp_str = `ntpq -c rv $ARGV[0]`;
$val = (split(/\\,/,$ntp_str))[20];
$val =~ s/offset=//i;
$val = int ($val + 100);
if ($val < 0) {
$val = 0;
}
print "0\\n";
print "$val\\n";
print "0\\n";
print "0\\n";

 
—————–ntppackets.pl—————————

#!/usr/bin/perl
use strict;
##################################
#ntppackets.pl
#source from ntp mailing lists
#http://lists.ntp.org/pipermail/pool/2012-July/006049.html
#### Options ####
my $uptimeprog = '/usr/bin/uptime'; # Set to program to give system uptime
my $hostnameprog = '/bin/hostname'; # Set to program to give system hostname
##### Nothing below here should have to be changed #####
# Clear path and get uptime
delete $ENV{PATH};
delete $ENV{BASH_ENV};
my $uptime = `$uptimeprog`;
chomp($uptime);
$uptime=substr($uptime,12);
my $hostname = `$hostnameprog`;
chomp($hostname);
my $received = 0;
my $sent = 0;
my $status = `/usr/bin/ntpdc -c iostats`;
if($status =~ m!received packets:\\s*(-?\\d+)!) {
$received=$1 + 2147483648;
}
if($status =~ m!packets sent:\\s*(-?\\d+)!) {
$sent=$1 + 2147483648;
}
print "$received\\n$sent\n$uptime\\n$hostname\\n";
-----------mrtg.conf---------------------------
#
# NTP Packets
#
Title[ntppackets]: XXX NTP packets
Target[ntppackets]: `/home/budiw/paket/ntp-mrtg/ntppackets.pl`
PageTop[ntppackets]: Received and sent NTP packets for yyy
MaxBytes[ntppackets]: 60000
Options[ntppackets]: growright, nopercent
YLegend[ntppackets]: #/s
ShortLegend[ntppackets]:
Legend1[ntppackets]: Received packets/s
Legend2[ntppackets]: Sent packets/s
Legend3[ntppackets]: Maximal 5 minute received packets/s
Legend4[ntppackets]: Maximal 5 minute sent packets/s
LegendI[ntppackets]:  received packets/s
LegendO[ntppackets]:  sent packets/s
WithPeak[ntppackets]: wmy
#
# NTP offsets
#
Target[xxx_ntp]: `perl /home/budiw/paket/ntp-mrtg/getntp.pl 127.0.0.1`
MaxBytes[xxx_ntp]: 100
MaxBytes2[xxx_ntp]: 200
Unscaled[xxx_ntp]: dwmy
Timezone[xxx_ntp]: GMT+7
Title[xxx_ntp]: NTP statistics for XXX - offset from NTP
Options[xxx_ntp]: integer, gauge, nopercent, growright
YLegend[xxx_ntp]: offset+100 ms
ShortLegend[xxx_ntp]: ms
LegendI[xxx_ntp]:
LegendO[xxx_ntp]: offset:
Legend1[xxx_ntp]: n/a
Legend2[xxx_ntp]: time offset in ms, with 100ms offset added to ensure it's positive!
PageTop[xxx_ntp]: NTP -- XXX

—————–
Here’s one example scripts on action:
NTP – Offsets+100ms

NTP – Received and sent NTP packets for alynne.blankon.in

BUDI MONITOR COM, mrtg ntp monitoring, mrtg ntp, ntp monitoring, ntp mrtg, monitoring ntp server, ntp server monitor, monitor ntp, ntp server monitoring, perl ntp drift script to monitor

Installing Mailing List Manager a.k.a Mailman on Ubuntu 6.06

Mailman Logo
Mailman

Recently I Installed a mailing list manager on my mailserver. I use GNU’s mailman. It’s straightforward and simple and they have a web-based administration. I’m following this tutorial from wiki.ubuntu.com.

But unfortunately, this tutorial has some error in configuration. After a long search finally I found that, the line at /etc/mailman/mm_cfg.py should be MTA = None. But in the tutorial is MTA = Postfix.

The configuration error is not quickly found, because the mailing list is running as usual. I found this error on this situation.

My server is postfix and using virtual mail. I have a mailbox called dummybox@example.com. Then I create a lists called dummybox@lists.example.com. Everytime I send an email to dummybox@example.com, postfix try to deliver the email to mailman. And whoops, its error!

After changing MTA to None, this error dissapear.

Update #1:
I change the  MTA to None on wiki.ubuntu.com. Thank God it’s wiki, a collaborated pages. So I can change the error.

ubuntu mailing list software, ubuntu mailing list manager, mailing list software ubuntu, installing maililig list manager, mailing list manager ubuntu, ubuntu mailing list, ubuntu mail manager, postfix mailing list manager, mailman ubuntu, installing mailing list manager in ubuntu

How to setup login prompt and grub via serial console

In my Office, I use a relatively small computer devices. I setup those boxes as router, located in network panel room together with switch and cable closet. There’s no monitor or keyboard there. So when there’s any error, I need an quick solutions to see what happened while boot.

I tried this with Ubuntu 10.04. This tutorial is not compatible with Ubuntu below 10.04.

First we set the getty, so we can log-in through serial console.

$ sudo vi /etc/init/ttyS0.conf
# ttyS0 - getty
#
# This service maintains a getty on ttyS0 from the point the system is
# started until it is shut down again.

start on stopped rc RUNLEVEL=[2345]
stop on runlevel [!2345]

respawn
exec /sbin/getty -L 38400 ttyS0 vt102

Then we setup the grub loader so it can show on serial ports too. Just adjust your grub configuration with this configuration.

$sudo vi /etc/default/grub
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.

GRUB_DEFAULT=0
GRUB_TIMEOUT=1
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"

# Uncomment to disable graphical terminal (grub-pc only)
GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480

# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true

After editing grub configuration, we update our grub with this command:

$sudo update-grub

Before we test the grub loader with serial, we should test the getty program. Now, on client computer, we install minicom program. I’m using USB2Serial that detected on port /dev/ttyUSB0. I use 38400 baud speed. Just adjust the 38400 with other speed if you like.

Let’s install the minicom program with this command:

$sudo apt-get install minicom

After that, launch the minicom program. Set the configuration like this. Press ^ao on the minicom screen.

+-----[configuration]------+
| Filenames and paths      |
| File transfer protocols  |
| Serial port setup        |
| Modem and dialing        |
| Screen and keyboard      |
| Save setup as dfl        |
| Save setup as..          |
| Exit                     |
+--------------------------+

Choose “Serial port setup”

+-----------------------------------------------------------------------+
| A -    Serial Device      : /dev/ttyUSB0                              |
| B - Lockfile Location     : /var/lock                                 |
| C -   Callin Program      :                                           |
| D -  Callout Program      :                                           |
| E -    Bps/Par/Bits       : 38400 8N1                                 |
| F - Hardware Flow Control : No                                        |
| G - Software Flow Control : No                                        |
|                                                                       |
|    Change which setting?                                              |
+-----------------------------------------------------------------------+

After done configurating, Save it as default by choosing “Save setup as dfl”. Then Let’s try to initialized the serial by pressing ^am . If success then we have a login prompt.

Ubuntu 10.04 LTS ro-bb-fa-fb-fe ttyS0                                           

ro-bb-fa-fb-fe login:

On the login screen we know that we use serial console by “ttyS0” It’s mean we use serial 0.

Reference:
[1]https://help.ubuntu.com/community/SerialConsoleHowto
[2]http://www.vanemery.com/Linux/Serial/serial-console.html

Buy Sabrent SBT-USC6M USB 2.0 to Serial (9-pin) DB-9 RS-232 (BLUE) at Amazon and get discounted price.

ubuntu 10 04 serial console, grub ttyusb0, GRUB_CMDLINE_LINUX_DEFAULT serial console, set up console ubuntu 10 04 ttys0, Ubuntu grub serial console, grub serial, grub serial console, grub cfg serial console, ubuntu 10 serial console, grub_cmdline_linux_default console