<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.tetrain.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hemant</id>
	<title>TetraWiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.tetrain.com/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Hemant"/>
	<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Special:Contributions/Hemant"/>
	<updated>2026-07-25T08:08:13Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.9</generator>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1576</id>
		<title>Extract partition data from xen image file</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1576"/>
		<updated>2014-02-22T15:20:05Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* GETTING DATA FROM XEN IMAGE FILE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;THE ISSUE WAS FACED ON 192.168.1.15 where a virtual machine had boot error :&lt;br /&gt;
&lt;br /&gt;
ERROR: boot loader didn&#039;t return any data!&lt;br /&gt;
&lt;br /&gt;
The virtual machine was not getting up so data has to be extracted &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GETTING DATA FROM XEN IMAGE FILE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== using kpartx utility ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# losetup -f     &lt;br /&gt;
/dev/loop0&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This shows the avialable physical loop file/device that is unused and can be used to add a loop device&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#losetup /dev/loop0 /HDD_500/images/javapostgresql.img&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Associated the image file to loop file/device&lt;br /&gt;
&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#kpartx -av /dev/loop0&lt;br /&gt;
&lt;br /&gt;
add map loop0p1 : 0 1024000 linear /dev/loop0 2048&lt;br /&gt;
add map loop0p2 : 0 60413952 linear /dev/loop0 1026048&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;This command reads partition tables on specified device and create device&lt;br /&gt;
       maps over partitions segments detected&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#losetup -a                  [lists all used loop files ]&lt;br /&gt;
&lt;br /&gt;
/dev/loop0: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
&lt;br /&gt;
#vgscan&lt;br /&gt;
&lt;br /&gt;
 Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;VolGroup&amp;quot; using metadata type lvm2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -ay VolGroup&lt;br /&gt;
 2 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
 &lt;br /&gt;
&#039;&#039;&#039;activate and  deactivate  VolumeGroupName, or all volume groups if none is specified.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
#lvs&lt;br /&gt;
 LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;
  lv_root VolGroup -wi-a- 27.80G                                      &lt;br /&gt;
  lv_swap VolGroup -wi-a-  1.00G    &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
#mount /dev/VolGroup/lv_root /mnt/data/&lt;br /&gt;
&lt;br /&gt;
NOW you can access your root partition in image on /mnt/data folder&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After data is copied unmount the partition&lt;br /&gt;
&lt;br /&gt;
#umount /mnt/data/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -an VolGroup&lt;br /&gt;
0 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#kpartx -d /dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup -d /dev/loop0           [delete from used]&lt;br /&gt;
&lt;br /&gt;
NOTE:  always remember to deactivate the logical volumes with &amp;quot;vgchange -an&amp;quot;, remove the partitions with &amp;quot;kpartx -d&amp;quot;, and (if appropriate) delete the loop device with &amp;quot;losetup -d&amp;quot; after you are finished. There are two reasons: first of all, the default volume group name for a install is always the same, so if you end up activating two disk images at the same time you&#039;ll end up with two separate LVM volume groups with the same name. LVM will cope as best it can, but you won&#039;t be able to distinguish between these two groups on the command line.&lt;br /&gt;
&lt;br /&gt;
And secondly, if you don&#039;t deactivate it, then if the guest is started up again, you might end up with the LVM being active in both the guest and the dom0 at the same time, and this may lead to VG or filesystem corruption.&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1575</id>
		<title>Extract partition data from xen image file</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1575"/>
		<updated>2014-02-22T15:11:31Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* GETTING DATA FROM XEN IMAGE FILE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;THE ISSUE WAS FACED ON 192.168.1.15 where a virtual machine had boot error :&lt;br /&gt;
&lt;br /&gt;
ERROR: boot loader didn&#039;t return any data!&lt;br /&gt;
&lt;br /&gt;
The virtual machine was not getting up so data has to be extracted &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GETTING DATA FROM XEN IMAGE FILE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using kpartx utility&lt;br /&gt;
&lt;br /&gt;
# losetup -f  [find unused loop files ]&lt;br /&gt;
/dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup /dev/loop0 /HDD_500/images/javapostgresql.img&lt;br /&gt;
&lt;br /&gt;
#kpartx -av /dev/loop0&lt;br /&gt;
&lt;br /&gt;
add map loop1p1 : 0 1024000 linear /dev/loop1 2048&lt;br /&gt;
add map loop1p2 : 0 60413952 linear /dev/loop1 1026048&lt;br /&gt;
&lt;br /&gt;
#losetup -a                  [lists all used loop files ]&lt;br /&gt;
&lt;br /&gt;
/dev/loop0: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
/dev/loop1: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
&lt;br /&gt;
#vgscan&lt;br /&gt;
&lt;br /&gt;
 Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;VolGroup&amp;quot; using metadata type lvm2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -ay VolGroup&lt;br /&gt;
 2 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
 &lt;br /&gt;
#lvs&lt;br /&gt;
 LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;
  lv_root VolGroup -wi-a- 27.80G                                      &lt;br /&gt;
  lv_swap VolGroup -wi-a-  1.00G    &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
#mount /dev/VolGroup/lv_root /mnt/data/&lt;br /&gt;
&lt;br /&gt;
NOW you can access your root partition in image on /mnt/data folder&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After data is copied unmount the partition&lt;br /&gt;
&lt;br /&gt;
#umount /mnt/data/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -an VolGroup&lt;br /&gt;
0 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#kpartx -d /dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup -d /dev/loop0           [delete from used]&lt;br /&gt;
&lt;br /&gt;
NOTE:  always remember to deactivate the logical volumes with &amp;quot;vgchange -an&amp;quot;, remove the partitions with &amp;quot;kpartx -d&amp;quot;, and (if appropriate) delete the loop device with &amp;quot;losetup -d&amp;quot; after you are finished. There are two reasons: first of all, the default volume group name for a install is always the same, so if you end up activating two disk images at the same time you&#039;ll end up with two separate LVM volume groups with the same name. LVM will cope as best it can, but you won&#039;t be able to distinguish between these two groups on the command line.&lt;br /&gt;
&lt;br /&gt;
And secondly, if you don&#039;t deactivate it, then if the guest is started up again, you might end up with the LVM being active in both the guest and the dom0 at the same time, and this may lead to VG or filesystem corruption.&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1574</id>
		<title>Extract partition data from xen image file</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1574"/>
		<updated>2014-02-22T14:41:38Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* GETTING DATA FROM XEN IMAGE FILE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;THE ISSUE WAS FACED ON 192.168.1.15 where a virtual machine had boot error :&lt;br /&gt;
&lt;br /&gt;
ERROR: boot loader didn&#039;t return any data!&lt;br /&gt;
&lt;br /&gt;
The virtual machine was not getting up so data has to be extracted &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GETTING DATA FROM XEN IMAGE FILE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using kpartx utility&lt;br /&gt;
&lt;br /&gt;
# losetup -f  -- find unused&lt;br /&gt;
/dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup /dev/loop0 /HDD_500/images/javapostgresql.img&lt;br /&gt;
&lt;br /&gt;
#kpartx -av /dev/loop0&lt;br /&gt;
add map loop1p1 : 0 1024000 linear /dev/loop1 2048&lt;br /&gt;
add map loop1p2 : 0 60413952 linear /dev/loop1 1026048&lt;br /&gt;
&lt;br /&gt;
#losetup -a                  ---lists all used&lt;br /&gt;
/dev/loop0: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
/dev/loop1: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
&lt;br /&gt;
#vgscan&lt;br /&gt;
&lt;br /&gt;
 Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;VolGroup&amp;quot; using metadata type lvm2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -ay VolGroup&lt;br /&gt;
 2 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
 &lt;br /&gt;
#lvs&lt;br /&gt;
 LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;
  lv_root VolGroup -wi-a- 27.80G                                      &lt;br /&gt;
  lv_swap VolGroup -wi-a-  1.00G    &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
#mount /dev/VolGroup/lv_root /mnt/data/&lt;br /&gt;
&lt;br /&gt;
NOW you can access your root partition in image on /mnt/data folder&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After data is copied unmount the partition&lt;br /&gt;
&lt;br /&gt;
#umount /mnt/data/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -an VolGroup&lt;br /&gt;
0 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#kpartx -d /dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup -d /dev/loop0           --delete from used&lt;br /&gt;
&lt;br /&gt;
NOTE:  always remember to deactivate the logical volumes with &amp;quot;vgchange -an&amp;quot;, remove the partitions with &amp;quot;kpartx -d&amp;quot;, and (if appropriate) delete the loop device with &amp;quot;losetup -d&amp;quot; after you are finished. There are two reasons: first of all, the default volume group name for a install is always the same, so if you end up activating two disk images at the same time you&#039;ll end up with two separate LVM volume groups with the same name. LVM will cope as best it can, but you won&#039;t be able to distinguish between these two groups on the command line.&lt;br /&gt;
&lt;br /&gt;
And secondly, if you don&#039;t deactivate it, then if the guest is started up again, you might end up with the LVM being active in both the guest and the dom0 at the same time, and this may lead to VG or filesystem corruption.&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1573</id>
		<title>Extract partition data from xen image file</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1573"/>
		<updated>2014-02-22T12:16:27Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* GETTING DATA FROM XEN IMAGE FILE */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;THE ISSUE WAS FACED ON 192.168.1.15 where a virtual machine had boot error :&lt;br /&gt;
&lt;br /&gt;
ERROR: boot loader didn&#039;t return any data!&lt;br /&gt;
&lt;br /&gt;
The virtual machine was not getting up so data has to be extracted &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GETTING DATA FROM XEN IMAGE FILE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using kpartx utility&lt;br /&gt;
&lt;br /&gt;
# losetup -f  -- find unused&lt;br /&gt;
/dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup /dev/loop0 /HDD_500/images/javapostgresql.img&lt;br /&gt;
&lt;br /&gt;
#kpartx -av /dev/loop0&lt;br /&gt;
add map loop1p1 : 0 1024000 linear /dev/loop1 2048&lt;br /&gt;
add map loop1p2 : 0 60413952 linear /dev/loop1 1026048&lt;br /&gt;
&lt;br /&gt;
#losetup -a                  ---lists all used&lt;br /&gt;
/dev/loop0: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
/dev/loop1: [0811]:32571394 (/HDD_500GB/images/javapostgresql.img)&lt;br /&gt;
&lt;br /&gt;
#vgscan&lt;br /&gt;
&lt;br /&gt;
 Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;VolGroup&amp;quot; using metadata type lvm2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -ay VolGroup&lt;br /&gt;
 2 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
 &lt;br /&gt;
#lvs&lt;br /&gt;
 LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;
  lv_root VolGroup -wi-a- 27.80G                                      &lt;br /&gt;
  lv_swap VolGroup -wi-a-  1.00G    &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
#mount /dev/VolGroup/lv_root /mnt/data/&lt;br /&gt;
&lt;br /&gt;
NOW you can access your root partition in image on /mnt/data folder&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After data is copied unmount the partition&lt;br /&gt;
&lt;br /&gt;
#umount /mnt/data/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -an VolGroup&lt;br /&gt;
0 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
&lt;br /&gt;
#losetup -d /dev/loop0           --delete from used&lt;br /&gt;
&lt;br /&gt;
NOTE:  always remember to deactivate the logical volumes with &amp;quot;vgchange -an&amp;quot;, remove the partitions with &amp;quot;kpartx -d&amp;quot;, and (if appropriate) delete the loop device with &amp;quot;losetup -d&amp;quot; after you are finished. There are two reasons: first of all, the default volume group name for a install is always the same, so if you end up activating two disk images at the same time you&#039;ll end up with two separate LVM volume groups with the same name. LVM will cope as best it can, but you won&#039;t be able to distinguish between these two groups on the command line.&lt;br /&gt;
&lt;br /&gt;
And secondly, if you don&#039;t deactivate it, then if the guest is started up again, you might end up with the LVM being active in both the guest and the dom0 at the same time, and this may lead to VG or filesystem corruption.&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1572</id>
		<title>Extract partition data from xen image file</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Extract_partition_data_from_xen_image_file&amp;diff=1572"/>
		<updated>2014-02-22T11:49:17Z</updated>

		<summary type="html">&lt;p&gt;Hemant: Created page with &amp;quot;THE ISSUE WAS FACED ON 192.168.1.15 where a virtual machine had boot error :  ERROR: boot loader didn&amp;#039;t return any data!  The virtual machine was not getting up so data has to...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;THE ISSUE WAS FACED ON 192.168.1.15 where a virtual machine had boot error :&lt;br /&gt;
&lt;br /&gt;
ERROR: boot loader didn&#039;t return any data!&lt;br /&gt;
&lt;br /&gt;
The virtual machine was not getting up so data has to be extracted &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== GETTING DATA FROM XEN IMAGE FILE ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using kpartx utility&lt;br /&gt;
&lt;br /&gt;
# losetup -f&lt;br /&gt;
/dev/loop0&lt;br /&gt;
&lt;br /&gt;
#losetup /dev/loop0 /HDD_500/images/javapostgresql.img&lt;br /&gt;
&lt;br /&gt;
#kpartx -av /dev/loop0&lt;br /&gt;
add map loop1p1 : 0 1024000 linear /dev/loop1 2048&lt;br /&gt;
add map loop1p2 : 0 60413952 linear /dev/loop1 1026048&lt;br /&gt;
&lt;br /&gt;
#vgscan&lt;br /&gt;
&lt;br /&gt;
 Reading all physical volumes.  This may take a while...&lt;br /&gt;
  Found volume group &amp;quot;VolGroup&amp;quot; using metadata type lvm2&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#vgchange -ay VolGroup&lt;br /&gt;
 2 logical volume(s) in volume group &amp;quot;VolGroup&amp;quot; now active&lt;br /&gt;
 &lt;br /&gt;
#lvs&lt;br /&gt;
 LV      VG       Attr   LSize  Origin Snap%  Move Log Copy%  Convert&lt;br /&gt;
  lv_root VolGroup -wi-a- 27.80G                                      &lt;br /&gt;
  lv_swap VolGroup -wi-a-  1.00G    &lt;br /&gt;
  &lt;br /&gt;
  &lt;br /&gt;
#mount /dev/VolGroup/lv_root /mnt/data/&lt;br /&gt;
&lt;br /&gt;
NOW you can access your root partition in image on /mnt/data folder&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Category:Heromotocorp/QMAIL_QUEUE_COUSTOM_SCRIPT&amp;diff=1542</id>
		<title>Category:Heromotocorp/QMAIL QUEUE COUSTOM SCRIPT</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Category:Heromotocorp/QMAIL_QUEUE_COUSTOM_SCRIPT&amp;diff=1542"/>
		<updated>2013-12-30T12:26:06Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
A script to get qmail queue status via qmHandle &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 STATE_OK=0&lt;br /&gt;
 STATE_WARNING=1&lt;br /&gt;
 STATE_CRITICAL=2&lt;br /&gt;
 STATE_UNKNOWN=3&lt;br /&gt;
 STATE_DEPENDENT=4&lt;br /&gt;
 warn=$1&lt;br /&gt;
 crit=$2&lt;br /&gt;
 QUEUE=`qmHandle -s | grep &amp;quot;Total messages&amp;quot;| awk &#039;BEGIN { FS = &amp;quot;:&amp;quot; } ; { print $2 }&#039;`&lt;br /&gt;
   &lt;br /&gt;
  if  [[ $QUEUE -lt $warn || $QUEUE -eq $warn ]]   &lt;br /&gt;
      &lt;br /&gt;
    then echo $QUEUE &amp;quot;Queue OK &amp;quot; ; exit ${STATE_OK} ;&lt;br /&gt;
  &lt;br /&gt;
   elif  [[ $QUEUE -gt $warn &amp;amp;&amp;amp; $QUEUE -lt $crit ]] &lt;br /&gt;
     &lt;br /&gt;
    then echo &amp;quot;QUEUE WARNING &amp;quot; $QUEUE ; exit ${STATE_WARNING} ;&lt;br /&gt;
 &lt;br /&gt;
 else&lt;br /&gt;
       &lt;br /&gt;
     echo &amp;quot;QUEUE CRITICAL&amp;quot; $QUEUE ; exit ${STATE_CRITICAL} ;&lt;br /&gt;
 &lt;br /&gt;
   fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ==&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Category:Heromotocorp/QMAIL_QUEUE_COUSTOM_SCRIPT&amp;diff=1541</id>
		<title>Category:Heromotocorp/QMAIL QUEUE COUSTOM SCRIPT</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Category:Heromotocorp/QMAIL_QUEUE_COUSTOM_SCRIPT&amp;diff=1541"/>
		<updated>2013-12-30T12:25:32Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
A script to get qmail queue status via qmHandle &lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;==&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 STATE_OK=0&lt;br /&gt;
 STATE_WARNING=1&lt;br /&gt;
 STATE_CRITICAL=2&lt;br /&gt;
 STATE_UNKNOWN=3&lt;br /&gt;
 STATE_DEPENDENT=4&lt;br /&gt;
 warn=$1&lt;br /&gt;
 crit=$2&lt;br /&gt;
 QUEUE=`qmHandle -s | grep &amp;quot;Total messages&amp;quot;| awk &#039;BEGIN { FS = &amp;quot;:&amp;quot; } ; { print $2 }&#039;`&lt;br /&gt;
   &lt;br /&gt;
  if   &amp;quot; [[ $QUEUE -lt $warn || $QUEUE -eq $warn ]] &amp;quot;    # remove  &amp;quot;&amp;quot;&lt;br /&gt;
      &lt;br /&gt;
    then echo $QUEUE &amp;quot;Queue OK &amp;quot; ; exit ${STATE_OK} ;&lt;br /&gt;
  &lt;br /&gt;
   elif &amp;quot; [[ $QUEUE -gt $warn &amp;amp;&amp;amp; $QUEUE -lt $crit ]] &amp;quot;   # remove &amp;quot;&amp;quot;&lt;br /&gt;
     &lt;br /&gt;
    then echo &amp;quot;QUEUE WARNING &amp;quot; $QUEUE ; exit ${STATE_WARNING} ;&lt;br /&gt;
 &lt;br /&gt;
 else&lt;br /&gt;
       &lt;br /&gt;
     echo &amp;quot;QUEUE CRITICAL&amp;quot; $QUEUE ; exit ${STATE_CRITICAL} ;&lt;br /&gt;
 &lt;br /&gt;
   fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ==&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Category:Heromotocorp/QMAIL_QUEUE_COUSTOM_SCRIPT&amp;diff=1540</id>
		<title>Category:Heromotocorp/QMAIL QUEUE COUSTOM SCRIPT</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Category:Heromotocorp/QMAIL_QUEUE_COUSTOM_SCRIPT&amp;diff=1540"/>
		<updated>2013-12-30T12:07:05Z</updated>

		<summary type="html">&lt;p&gt;Hemant: Created page with &amp;quot; A script to get qmail queue status via qmHandle    ==   #!/bin/bash  STATE_OK=0  STATE_WARNING=1  STATE_CRITICAL=2  STATE_UNKNOWN=3  STATE_DEPENDENT=4  warn=$1  crit=$2  QUEU...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
A script to get qmail queue status via qmHandle &lt;br /&gt;
&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
 #!/bin/bash&lt;br /&gt;
 STATE_OK=0&lt;br /&gt;
 STATE_WARNING=1&lt;br /&gt;
 STATE_CRITICAL=2&lt;br /&gt;
 STATE_UNKNOWN=3&lt;br /&gt;
 STATE_DEPENDENT=4&lt;br /&gt;
 warn=$1&lt;br /&gt;
 crit=$2&lt;br /&gt;
 QUEUE=`qmHandle -s | grep &amp;quot;Total messages&amp;quot;| awk &#039;BEGIN { FS = &amp;quot;:&amp;quot; } ; { print $2 }&#039;`&lt;br /&gt;
 if [[ $QUEUE -lt $warn || $QUEUE -eq $warn ]]&lt;br /&gt;
        then echo $QUEUE &amp;quot;Queue OK &amp;quot; ; exit ${STATE_OK} ;&lt;br /&gt;
 elif [[ $QUEUE -gt $warn &amp;amp;&amp;amp; $QUEUE -lt $crit ]]&lt;br /&gt;
        then echo &amp;quot;QUEUE WARNING &amp;quot; $QUEUE ; exit ${STATE_WARNING} ;&lt;br /&gt;
 else&lt;br /&gt;
        echo &amp;quot;QUEUE CRITICAL&amp;quot; $QUEUE ; exit ${STATE_CRITICAL} ;&lt;br /&gt;
 fi&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 ==&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=File:Heromotocorp%27s_Mail_Architecture.png&amp;diff=1539</id>
		<title>File:Heromotocorp&#039;s Mail Architecture.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=File:Heromotocorp%27s_Mail_Architecture.png&amp;diff=1539"/>
		<updated>2013-12-18T07:10:31Z</updated>

		<summary type="html">&lt;p&gt;Hemant: uploaded a new version of &amp;amp;quot;File:Heromotocorp&amp;#039;s Mail Architecture.png&amp;amp;quot;: Reverted to version as of 09:11, 14 January 2013&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=File:Heromotocorp%27s_Mail_Architecture.png&amp;diff=1538</id>
		<title>File:Heromotocorp&#039;s Mail Architecture.png</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=File:Heromotocorp%27s_Mail_Architecture.png&amp;diff=1538"/>
		<updated>2013-12-18T06:55:33Z</updated>

		<summary type="html">&lt;p&gt;Hemant: uploaded a new version of &amp;amp;quot;File:Heromotocorp&amp;#039;s Mail Architecture.png&amp;amp;quot;: Incoming mails routed only to Delhi server 
Outgoing only via ggn server&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1481</id>
		<title>Main Page/Nagios add Indirect Host and Service Checks</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1481"/>
		<updated>2013-10-30T19:58:35Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* On Nagios Server : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:/root/Desktop/indirectsvccheck_converted.jpg]]&lt;br /&gt;
== Headline text ==&lt;br /&gt;
&#039;&#039;&#039;NAGIOS INDIRECT MAPPING OF HOSTS&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Environments that have multiple servers and only one server or firewall is accessible directly i.e one server is accessible and all others may be accessed through it internally . Nagios mapping may be done via Indirect Host and Service Checks using nrpe.&lt;br /&gt;
&lt;br /&gt;
Indirect checks are useful for: &lt;br /&gt;
Monitoring &amp;quot;local&amp;quot; resources (such as disk usage, processer load, etc.) on remote hosts&lt;br /&gt;
 &lt;br /&gt;
Monitoring services and hosts behind firewalls &lt;br /&gt;
&lt;br /&gt;
Obtaining more realistic results from checks of time-sensitive services between remote hosts (i.e. ping response times between two remote hosts)&lt;br /&gt;
 &lt;br /&gt;
Indirect service check Senario :&lt;br /&gt;
&lt;br /&gt;
As in 2coms there is a backup server associated with the main server indirectly accessible via the mailserver &lt;br /&gt;
&lt;br /&gt;
Access IP : zimbraserver.2coms.com/115.248.160.99&lt;br /&gt;
&lt;br /&gt;
Mailserver Internal Ip : 192.168.1.3 ( primary server)&lt;br /&gt;
&lt;br /&gt;
Backup server Ip :`192.168.1.5 (secondary server)&lt;br /&gt;
&lt;br /&gt;
== Procedure Taken : ==&lt;br /&gt;
&lt;br /&gt;
== on directly accessible  ( primary ) server : ==&lt;br /&gt;
&lt;br /&gt;
1. Access mail-server ( server already mapped as directly accesible )&lt;br /&gt;
&lt;br /&gt;
2. Install check_nrpe plugin if not present &lt;br /&gt;
&lt;br /&gt;
# yum install nagios-plugins-nrpe&lt;br /&gt;
&lt;br /&gt;
3. now add entry in nrpe.cfg for each service you want to check on the secondary/passive server as shown below :&lt;br /&gt;
&lt;br /&gt;
COMMANDS FOR MAIN SERVER&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 7% -c 5% -p /dev/sda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/local/nagios/libexec/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/local/nagios/libexec/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_clam_ud]=sudo -u zimbra /usr/local/nagios/libexec/check_clamav -w 2 -c 5&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp]=/usr/local/nagios/libexec/check_smtp -H localhost -p 7025 -e &#039;220 zimbraserver.2coms.com Zimbra LMTP server ready&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;# following commands are for backup server 192.168.1.5&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
command[check_users2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_users&lt;br /&gt;
&lt;br /&gt;
command[check_load2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_load&lt;br /&gt;
&lt;br /&gt;
command[check_hda12]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda22]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda2&lt;br /&gt;
&lt;br /&gt;
command[check_hda32]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zombie_procs&lt;br /&gt;
&lt;br /&gt;
command[check_cpu2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_cpu&lt;br /&gt;
&lt;br /&gt;
command[check_mem2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_mem&lt;br /&gt;
&lt;br /&gt;
command[check_clam2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_clam&lt;br /&gt;
&lt;br /&gt;
command[check_queue2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_queue&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zimbra_lmtp&lt;br /&gt;
&lt;br /&gt;
== on Secondary ( Backup ) server : ==&lt;br /&gt;
&lt;br /&gt;
Install nrpe and nagios plugins :&lt;br /&gt;
&lt;br /&gt;
	 # yum install nrpe nagios-plugins-all&lt;br /&gt;
&lt;br /&gt;
edit nrpe.cfg as follows :&lt;br /&gt;
&lt;br /&gt;
allowed_hosts=127.0.0.1,192.168.1.3&lt;br /&gt;
&lt;br /&gt;
And also add plugin definition as :&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda3&lt;br /&gt;
&lt;br /&gt;
command[check_hda2]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda3]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /dev/sda1&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/lib64/nagios/plugins/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/lib64/nagios/plugins/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
Restart nrpe on this server &lt;br /&gt;
&lt;br /&gt;
Restart nrpe on Primary server &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On Nagios Server : ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Add Host entry in /usr/local/nagios/etc/objects/linux-box.cfg with Access Ip :&lt;br /&gt;
&lt;br /&gt;
Entries for Primary Server : &lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  zimbraserver.2coms.com&lt;br /&gt;
             alias      zimbraserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Entries for Secondary Server :&lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  backupserver.2coms.com&lt;br /&gt;
             alias      backupserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Note :  address field is same for both host &lt;br /&gt;
&lt;br /&gt;
add service definition in /usr/local/nagios/etc/service/backupserver.2coms.com.cfg  for all services already defined in nrpe.cfg on primary host  &lt;br /&gt;
&lt;br /&gt;
eg :&lt;br /&gt;
&lt;br /&gt;
define service{&lt;br /&gt;
               use                      generic-service&lt;br /&gt;
               host_name                backupserver.2coms.com&lt;br /&gt;
               service_description      Current Users&lt;br /&gt;
               check_command            check_nrpe!check_users2&lt;br /&gt;
              }&lt;br /&gt;
&lt;br /&gt;
check nagios configuration &lt;br /&gt;
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
Reload nagios&lt;br /&gt;
	/etc/init.d/nagios reload&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1480</id>
		<title>Main Page/Nagios add Indirect Host and Service Checks</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1480"/>
		<updated>2013-10-30T19:00:44Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* on directly accessible  ( primary ) server : */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:/root/Desktop/indirectsvccheck_converted.jpg]]&lt;br /&gt;
== Headline text ==&lt;br /&gt;
&#039;&#039;&#039;NAGIOS INDIRECT MAPPING OF HOSTS&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Environments that have multiple servers and only one server or firewall is accessible directly i.e one server is accessible and all others may be accessed through it internally . Nagios mapping may be done via Indirect Host and Service Checks using nrpe.&lt;br /&gt;
&lt;br /&gt;
Indirect checks are useful for: &lt;br /&gt;
Monitoring &amp;quot;local&amp;quot; resources (such as disk usage, processer load, etc.) on remote hosts&lt;br /&gt;
 &lt;br /&gt;
Monitoring services and hosts behind firewalls &lt;br /&gt;
&lt;br /&gt;
Obtaining more realistic results from checks of time-sensitive services between remote hosts (i.e. ping response times between two remote hosts)&lt;br /&gt;
 &lt;br /&gt;
Indirect service check Senario :&lt;br /&gt;
&lt;br /&gt;
As in 2coms there is a backup server associated with the main server indirectly accessible via the mailserver &lt;br /&gt;
&lt;br /&gt;
Access IP : zimbraserver.2coms.com/115.248.160.99&lt;br /&gt;
&lt;br /&gt;
Mailserver Internal Ip : 192.168.1.3 ( primary server)&lt;br /&gt;
&lt;br /&gt;
Backup server Ip :`192.168.1.5 (secondary server)&lt;br /&gt;
&lt;br /&gt;
== Procedure Taken : ==&lt;br /&gt;
&lt;br /&gt;
== on directly accessible  ( primary ) server : ==&lt;br /&gt;
&lt;br /&gt;
1. Access mail-server ( server already mapped as directly accesible )&lt;br /&gt;
&lt;br /&gt;
2. Install check_nrpe plugin if not present &lt;br /&gt;
&lt;br /&gt;
# yum install nagios-plugins-nrpe&lt;br /&gt;
&lt;br /&gt;
3. now add entry in nrpe.cfg for each service you want to check on the secondary/passive server as shown below :&lt;br /&gt;
&lt;br /&gt;
COMMANDS FOR MAIN SERVER&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 7% -c 5% -p /dev/sda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/local/nagios/libexec/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/local/nagios/libexec/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_clam_ud]=sudo -u zimbra /usr/local/nagios/libexec/check_clamav -w 2 -c 5&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp]=/usr/local/nagios/libexec/check_smtp -H localhost -p 7025 -e &#039;220 zimbraserver.2coms.com Zimbra LMTP server ready&#039;&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;# following commands are for backup server 192.168.1.5&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
command[check_users2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_users&lt;br /&gt;
&lt;br /&gt;
command[check_load2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_load&lt;br /&gt;
&lt;br /&gt;
command[check_hda12]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda22]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda2&lt;br /&gt;
&lt;br /&gt;
command[check_hda32]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zombie_procs&lt;br /&gt;
&lt;br /&gt;
command[check_cpu2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_cpu&lt;br /&gt;
&lt;br /&gt;
command[check_mem2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_mem&lt;br /&gt;
&lt;br /&gt;
command[check_clam2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_clam&lt;br /&gt;
&lt;br /&gt;
command[check_queue2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_queue&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zimbra_lmtp&lt;br /&gt;
&lt;br /&gt;
== on Secondary ( Backup ) server : ==&lt;br /&gt;
&lt;br /&gt;
Install nrpe and nagios plugins :&lt;br /&gt;
&lt;br /&gt;
	 # yum install nrpe nagios-plugins-all&lt;br /&gt;
&lt;br /&gt;
edit nrpe.cfg as follows :&lt;br /&gt;
&lt;br /&gt;
allowed_hosts=127.0.0.1,192.168.1.3&lt;br /&gt;
&lt;br /&gt;
And also add plugin definition as :&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda3&lt;br /&gt;
&lt;br /&gt;
command[check_hda2]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda3]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /dev/sda1&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/lib64/nagios/plugins/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/lib64/nagios/plugins/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
Restart nrpe on this server &lt;br /&gt;
&lt;br /&gt;
Restart nrpe on Primary server &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On Nagios Server : ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Add Host entry in /usr/local/nagios/etc/objects/linux-box.cfg with Access Ip :&lt;br /&gt;
&lt;br /&gt;
Entries for Primary Server : &lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  zimbraserver.2coms.com&lt;br /&gt;
             alias      zimbraserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Entries for Secondary Server :&lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  backupserver.2coms.com&lt;br /&gt;
             alias      backupserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Note :  address field is same for both host &lt;br /&gt;
&lt;br /&gt;
add service definition in /usr/local/nagios/etc/service/backupserver.2coms.com.cfg  for all services already defined in nrpe.cfg on primary host  &lt;br /&gt;
&lt;br /&gt;
eg :&lt;br /&gt;
&lt;br /&gt;
define service{&lt;br /&gt;
               use                      generic-service&lt;br /&gt;
               host_name                backupserver.2coms.com&lt;br /&gt;
               service_description      Current Users&lt;br /&gt;
               check_command            check_nrpe!check_users2&lt;br /&gt;
              }&lt;br /&gt;
&lt;br /&gt;
check nagios configuration &lt;br /&gt;
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
Reload nagios configuration&lt;br /&gt;
	/etc/init.d/nagios reload&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=File:Indirectsvccheck_converted.jpg&amp;diff=1479</id>
		<title>File:Indirectsvccheck converted.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=File:Indirectsvccheck_converted.jpg&amp;diff=1479"/>
		<updated>2013-10-30T17:52:20Z</updated>

		<summary type="html">&lt;p&gt;Hemant: uploaded a new version of &amp;amp;quot;File:Indirectsvccheck converted.jpg&amp;amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This shows How mapping of indirect hosts is done&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=File:Indirectsvccheck_converted.jpg&amp;diff=1478</id>
		<title>File:Indirectsvccheck converted.jpg</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=File:Indirectsvccheck_converted.jpg&amp;diff=1478"/>
		<updated>2013-10-30T17:49:45Z</updated>

		<summary type="html">&lt;p&gt;Hemant: This shows How mapping of indirect hosts is done&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This shows How mapping of indirect hosts is done&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1477</id>
		<title>Main Page/Nagios add Indirect Host and Service Checks</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1477"/>
		<updated>2013-10-30T17:47:46Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:/root/Desktop/indirectsvccheck_converted.jpg]]&lt;br /&gt;
== Headline text ==&lt;br /&gt;
&#039;&#039;&#039;NAGIOS INDIRECT MAPPING OF HOSTS&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Environments that have multiple servers and only one server or firewall is accessible directly i.e one server is accessible and all others may be accessed through it internally . Nagios mapping may be done via Indirect Host and Service Checks using nrpe.&lt;br /&gt;
&lt;br /&gt;
Indirect checks are useful for: &lt;br /&gt;
Monitoring &amp;quot;local&amp;quot; resources (such as disk usage, processer load, etc.) on remote hosts&lt;br /&gt;
 &lt;br /&gt;
Monitoring services and hosts behind firewalls &lt;br /&gt;
&lt;br /&gt;
Obtaining more realistic results from checks of time-sensitive services between remote hosts (i.e. ping response times between two remote hosts)&lt;br /&gt;
 &lt;br /&gt;
Indirect service check Senario :&lt;br /&gt;
&lt;br /&gt;
As in 2coms there is a backup server associated with the main server indirectly accessible via the mailserver &lt;br /&gt;
&lt;br /&gt;
Access IP : zimbraserver.2coms.com/115.248.160.99&lt;br /&gt;
&lt;br /&gt;
Mailserver Internal Ip : 192.168.1.3 ( primary server)&lt;br /&gt;
&lt;br /&gt;
Backup server Ip :`192.168.1.5 (secondary server)&lt;br /&gt;
&lt;br /&gt;
== Procedure Taken : ==&lt;br /&gt;
&lt;br /&gt;
== on directly accessible  ( primary ) server : ==&lt;br /&gt;
&lt;br /&gt;
1. Access mail-server ( server already mapped as directly accesible )&lt;br /&gt;
&lt;br /&gt;
2. Install check_nrpe plugin if not present &lt;br /&gt;
&lt;br /&gt;
# yum install nagios-plugins-nrpe&lt;br /&gt;
&lt;br /&gt;
3. now add entry in nrpe.cfg for each service you want to check on the secondary/passive server as shown below :&lt;br /&gt;
&lt;br /&gt;
COMMANDS FOR MAIN SERVER&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 7% -c 5% -p /dev/sda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/local/nagios/libexec/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/local/nagios/libexec/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_clam_ud]=sudo -u zimbra /usr/local/nagios/libexec/check_clamav -w 2 -c 5&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp]=/usr/local/nagios/libexec/check_smtp -H localhost -p 7025 -e &#039;220 zimbraserver.2coms.com Zimbra LMTP server ready&#039;&lt;br /&gt;
&lt;br /&gt;
# following commands are for backup server 192.168.1.5&lt;br /&gt;
&lt;br /&gt;
command[check_users2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_users&lt;br /&gt;
&lt;br /&gt;
command[check_load2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_load&lt;br /&gt;
&lt;br /&gt;
command[check_hda12]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda22]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda2&lt;br /&gt;
&lt;br /&gt;
command[check_hda32]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zombie_procs&lt;br /&gt;
&lt;br /&gt;
command[check_cpu2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_cpu&lt;br /&gt;
&lt;br /&gt;
command[check_mem2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_mem&lt;br /&gt;
&lt;br /&gt;
command[check_clam2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_clam&lt;br /&gt;
&lt;br /&gt;
command[check_queue2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_queue&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zimbra_lmtp&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== on Secondary ( Backup ) server : ==&lt;br /&gt;
&lt;br /&gt;
Install nrpe and nagios plugins :&lt;br /&gt;
&lt;br /&gt;
	 # yum install nrpe nagios-plugins-all&lt;br /&gt;
&lt;br /&gt;
edit nrpe.cfg as follows :&lt;br /&gt;
&lt;br /&gt;
allowed_hosts=127.0.0.1,192.168.1.3&lt;br /&gt;
&lt;br /&gt;
And also add plugin definition as :&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda3&lt;br /&gt;
&lt;br /&gt;
command[check_hda2]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda3]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /dev/sda1&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/lib64/nagios/plugins/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/lib64/nagios/plugins/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
Restart nrpe on this server &lt;br /&gt;
&lt;br /&gt;
Restart nrpe on Primary server &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On Nagios Server : ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Add Host entry in /usr/local/nagios/etc/objects/linux-box.cfg with Access Ip :&lt;br /&gt;
&lt;br /&gt;
Entries for Primary Server : &lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  zimbraserver.2coms.com&lt;br /&gt;
             alias      zimbraserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Entries for Secondary Server :&lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  backupserver.2coms.com&lt;br /&gt;
             alias      backupserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Note :  address field is same for both host &lt;br /&gt;
&lt;br /&gt;
add service definition in /usr/local/nagios/etc/service/backupserver.2coms.com.cfg  for all services already defined in nrpe.cfg on primary host  &lt;br /&gt;
&lt;br /&gt;
eg :&lt;br /&gt;
&lt;br /&gt;
define service{&lt;br /&gt;
               use                      generic-service&lt;br /&gt;
               host_name                backupserver.2coms.com&lt;br /&gt;
               service_description      Current Users&lt;br /&gt;
               check_command            check_nrpe!check_users2&lt;br /&gt;
              }&lt;br /&gt;
&lt;br /&gt;
check nagios configuration &lt;br /&gt;
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
Reload nagios configuration&lt;br /&gt;
	/etc/init.d/nagios reload&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1476</id>
		<title>Main Page/Nagios add Indirect Host and Service Checks</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/Nagios_add_Indirect_Host_and_Service_Checks&amp;diff=1476"/>
		<updated>2013-10-30T17:39:52Z</updated>

		<summary type="html">&lt;p&gt;Hemant: Created page with &amp;quot; == Headline text == &amp;#039;&amp;#039;&amp;#039;NAGIOS INDIRECT MAPPING OF HOSTS&amp;#039;&amp;#039;&amp;#039;   For Environments that have multiple servers and only one server or firewall is accessible directly i.e one server...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== Headline text ==&lt;br /&gt;
&#039;&#039;&#039;NAGIOS INDIRECT MAPPING OF HOSTS&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For Environments that have multiple servers and only one server or firewall is accessible directly i.e one server is accessible and all others may be accessed through it internally . Nagios mapping may be done via Indirect Host and Service Checks using nrpe.&lt;br /&gt;
&lt;br /&gt;
Indirect checks are useful for: &lt;br /&gt;
Monitoring &amp;quot;local&amp;quot; resources (such as disk usage, processer load, etc.) on remote hosts&lt;br /&gt;
 &lt;br /&gt;
Monitoring services and hosts behind firewalls &lt;br /&gt;
&lt;br /&gt;
Obtaining more realistic results from checks of time-sensitive services between remote hosts (i.e. ping response times between two remote hosts)&lt;br /&gt;
 &lt;br /&gt;
Indirect service check Senario :&lt;br /&gt;
&lt;br /&gt;
As in 2coms there is a backup server associated with the main server indirectly accessible via the mailserver &lt;br /&gt;
&lt;br /&gt;
Access IP : zimbraserver.2coms.com/115.248.160.99&lt;br /&gt;
&lt;br /&gt;
Mailserver Internal Ip : 192.168.1.3 ( primary server)&lt;br /&gt;
&lt;br /&gt;
Backup server Ip :`192.168.1.5 (secondary server)&lt;br /&gt;
&lt;br /&gt;
== Procedure Taken : ==&lt;br /&gt;
&lt;br /&gt;
== on directly accessible  ( primary ) server : ==&lt;br /&gt;
&lt;br /&gt;
1. Access mail-server ( server already mapped as directly accesible )&lt;br /&gt;
&lt;br /&gt;
2. Install check_nrpe plugin if not present &lt;br /&gt;
&lt;br /&gt;
# yum install nagios-plugins-nrpe&lt;br /&gt;
&lt;br /&gt;
3. now add entry in nrpe.cfg for each service you want to check on the secondary/passive server as shown below :&lt;br /&gt;
&lt;br /&gt;
COMMANDS FOR MAIN SERVER&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/local/nagios/libexec/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/local/nagios/libexec/check_disk -w 7% -c 5% -p /dev/sda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/local/nagios/libexec/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/local/nagios/libexec/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/local/nagios/libexec/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/local/nagios/libexec/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/local/nagios/libexec/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_clam_ud]=sudo -u zimbra /usr/local/nagios/libexec/check_clamav -w 2 -c 5&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp]=/usr/local/nagios/libexec/check_smtp -H localhost -p 7025 -e &#039;220 zimbraserver.2coms.com Zimbra LMTP server ready&#039;&lt;br /&gt;
&lt;br /&gt;
# following commands are for backup server 192.168.1.5&lt;br /&gt;
&lt;br /&gt;
command[check_users2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_users&lt;br /&gt;
&lt;br /&gt;
command[check_load2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_load&lt;br /&gt;
&lt;br /&gt;
command[check_hda12]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda22]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda2&lt;br /&gt;
&lt;br /&gt;
command[check_hda32]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_hda3&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zombie_procs&lt;br /&gt;
&lt;br /&gt;
command[check_cpu2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_cpu&lt;br /&gt;
&lt;br /&gt;
command[check_mem2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_mem&lt;br /&gt;
&lt;br /&gt;
command[check_clam2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_clam&lt;br /&gt;
&lt;br /&gt;
command[check_queue2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_queue&lt;br /&gt;
&lt;br /&gt;
command[check_zimbra_lmtp2]=/usr/local/nagios/libexec/check_nrpe -H 192.168.1.5 -c check_zimbra_lmtp&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== on Secondary ( Backup ) server : ==&lt;br /&gt;
&lt;br /&gt;
Install nrpe and nagios plugins :&lt;br /&gt;
&lt;br /&gt;
	 # yum install nrpe nagios-plugins-all&lt;br /&gt;
&lt;br /&gt;
edit nrpe.cfg as follows :&lt;br /&gt;
&lt;br /&gt;
allowed_hosts=127.0.0.1,192.168.1.3&lt;br /&gt;
&lt;br /&gt;
And also add plugin definition as :&lt;br /&gt;
&lt;br /&gt;
command[check_users]=/usr/lib64/nagios/plugins/check_users -w 5 -c 10&lt;br /&gt;
&lt;br /&gt;
command[check_load]=/usr/lib64/nagios/plugins/check_load -w 15,10,5 -c 30,25,20&lt;br /&gt;
&lt;br /&gt;
command[check_hda1]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda3&lt;br /&gt;
&lt;br /&gt;
command[check_hda2]=/usr/lib64/nagios/plugins/check_disk -w 7% -c 5% -p /dev/hda1&lt;br /&gt;
&lt;br /&gt;
command[check_hda3]=/usr/lib64/nagios/plugins/check_disk -w 10% -c 5% -p /dev/sda1&lt;br /&gt;
&lt;br /&gt;
command[check_zombie_procs]=/usr/lib64/nagios/plugins/check_procs -w 5 -c 10 -s Z&lt;br /&gt;
&lt;br /&gt;
command[check_cpu]=/usr/lib64/nagios/plugins/check_cpu.sh -w 60 -c 70&lt;br /&gt;
&lt;br /&gt;
command[check_mem]=/usr/lib64/nagios/plugins/check_mem_avail -w 130 -c 150&lt;br /&gt;
&lt;br /&gt;
command[check_clam]=/usr/lib64/nagios/plugins/check_clamd -H localhost&lt;br /&gt;
&lt;br /&gt;
command[check_queue]=/usr/lib64/nagios/plugins/check_postfix_queue -w 300 -c 500&lt;br /&gt;
&lt;br /&gt;
Restart nrpe on this server &lt;br /&gt;
&lt;br /&gt;
Restart nrpe on Primary server &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== On Nagios Server : ==&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
Add Host entry in /usr/local/nagios/etc/objects/linux-box.cfg with Access Ip :&lt;br /&gt;
&lt;br /&gt;
Entries for Primary Server : &lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  zimbraserver.2coms.com&lt;br /&gt;
             alias      zimbraserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Entries for Secondary Server :&lt;br /&gt;
&lt;br /&gt;
define host{&lt;br /&gt;
             use        linux-server&lt;br /&gt;
             host_name  backupserver.2coms.com&lt;br /&gt;
             alias      backupserver.2coms.com&lt;br /&gt;
             address    182.71.172.155&lt;br /&gt;
             hostgroups  Tetra Clients  ; Host groups&lt;br /&gt;
           }&lt;br /&gt;
&lt;br /&gt;
Note :  address field is same for both host &lt;br /&gt;
&lt;br /&gt;
add service definition in /usr/local/nagios/etc/service/backupserver.2coms.com.cfg  for all services already defined in nrpe.cfg on primary host  &lt;br /&gt;
&lt;br /&gt;
eg :&lt;br /&gt;
&lt;br /&gt;
define service{&lt;br /&gt;
               use                      generic-service&lt;br /&gt;
               host_name                backupserver.2coms.com&lt;br /&gt;
               service_description      Current Users&lt;br /&gt;
               check_command            check_nrpe!check_users2&lt;br /&gt;
              }&lt;br /&gt;
&lt;br /&gt;
check nagios configuration &lt;br /&gt;
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg&lt;br /&gt;
&lt;br /&gt;
Reload nagios configuration&lt;br /&gt;
	/etc/init.d/nagios reload&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1409</id>
		<title>Main Page/postfix mail statistics</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1409"/>
		<updated>2013-09-05T11:15:16Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Postfix mail statistics via log analyzer&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a log analyzer for Postfix. The generated report can show you patterns in email traffic so you can better determine mail server abusers or if your mail server needs to be upgraded. &lt;br /&gt;
&lt;br /&gt;
Statistics can be very helpful in showing, for example, when most of your mail is sent or received or if that one mail user is sending out more than their fair share of mail. &lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a single perl file and its only dependancies are perl, the perl module Date::Calc (which is probably already installed on your system) and the proper location of a Postfix log file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 2 ways to install pflogsumm :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 1 : ==&lt;br /&gt;
&lt;br /&gt;
Step 1: To get started you first need to download the pflogsumm.pl perl script. from the link :&lt;br /&gt;
&lt;br /&gt;
    jimsun.linxnet.com/downloads/pflogsumm-1.1.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
Step 2: Extract the files from the tar ball and put _only_ the perl script pflogsumm.pl into /usr/sbin/ . Make sure the permissions are 700 for security.&lt;br /&gt;
&lt;br /&gt;
Step 3: get statistics out of logs :&lt;br /&gt;
   /usr/sbin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 2: ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
install pflogsumm &lt;br /&gt;
&lt;br /&gt;
apt-get install pflogsumm &lt;br /&gt;
&lt;br /&gt;
get statistics out of logs :&lt;br /&gt;
   /usr/sbin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
== &lt;br /&gt;
INSTALL A NEW CRONTAB FOR GETTING REGULAR UPDATE OF EACH DAYS MAIL STATISTICS&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
59 23  * * * /usr/sbin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log | mail -s &amp;quot;pflogsumm report &amp;quot; root@localhost&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1408</id>
		<title>Main Page/postfix mail statistics</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1408"/>
		<updated>2013-09-05T11:09:01Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Postfix mail statistics via log analyzer&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a log analyzer for Postfix. The generated report can show you patterns in email traffic so you can better determine mail server abusers or if your mail server needs to be upgraded. &lt;br /&gt;
&lt;br /&gt;
Statistics can be very helpful in showing, for example, when most of your mail is sent or received or if that one mail user is sending out more than their fair share of mail. &lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a single perl file and its only dependancies are perl, the perl module Date::Calc (which is probably already installed on your system) and the proper location of a Postfix log file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 2 ways to install pflogsumm :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 1 : ==&lt;br /&gt;
&lt;br /&gt;
Step 1: To get started you first need to download the pflogsumm.pl perl script. from the link :&lt;br /&gt;
&lt;br /&gt;
    jimsun.linxnet.com/downloads/pflogsumm-1.1.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
Step 2: Extract the files from the tar ball and put _only_ the perl script pflogsumm.pl into /usr/local/bin/ . Make sure the permissions are 700 for security.&lt;br /&gt;
&lt;br /&gt;
Step 3: get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 2: ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
install pflogsumm &lt;br /&gt;
&lt;br /&gt;
apt-get install pflogsumm &lt;br /&gt;
&lt;br /&gt;
get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
== &lt;br /&gt;
INSTALL A NEW CRONTAB FOR GETTING REGULAR UPDATE OF EACH DAYS MAIL STATISTICS&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
59 23  * * * /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log | mail -s &amp;quot;pflogsumm report &amp;quot; root@localhost&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1407</id>
		<title>Main Page/postfix mail statistics</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1407"/>
		<updated>2013-09-05T11:07:47Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Postfix mail statistics via log analyzer&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a log analyzer for Postfix. The generated report can show you patterns in email traffic so you can better determine mail server abusers or if your mail server needs to be upgraded. &lt;br /&gt;
&lt;br /&gt;
Statistics can be very helpful in showing, for example, when most of your mail is sent or received or if that one mail user is sending out more than their fair share of mail. &lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a single perl file and its only dependancies are perl, the perl module Date::Calc (which is probably already installed on your system) and the proper location of a Postfix log file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 2 ways to install pflogsumm :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 1 : ==&lt;br /&gt;
&lt;br /&gt;
Step 1: To get started you first need to download the pflogsumm.pl perl script. from the link :&lt;br /&gt;
&lt;br /&gt;
    jimsun.linxnet.com/downloads/pflogsumm-1.1.0.tar.gz&lt;br /&gt;
&lt;br /&gt;
Step 2: Extract the files from the tar ball and put _only_ the perl script pflogsumm.pl into /usr/local/bin/ . Make sure the permissions are 700 for security.&lt;br /&gt;
&lt;br /&gt;
Step 3: get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 2: ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
install pflogsumm &lt;br /&gt;
&lt;br /&gt;
get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
== &lt;br /&gt;
INSTALL A NEW CRONTAB FOR GETTING REGULAR UPDATE OF EACH DAYS MAIL STATISTICS&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
59 23  * * * /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log | mail -s &amp;quot;pflogsumm report &amp;quot; root@localhost&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1406</id>
		<title>Main Page/postfix mail statistics</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1406"/>
		<updated>2013-09-05T11:06:34Z</updated>

		<summary type="html">&lt;p&gt;Hemant: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Postfix mail statistics via log analyzer&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a log analyzer for Postfix. The generated report can show you patterns in email traffic so you can better determine mail server abusers or if your mail server needs to be upgraded. &lt;br /&gt;
&lt;br /&gt;
Statistics can be very helpful in showing, for example, when most of your mail is sent or received or if that one mail user is sending out more than their fair share of mail. &lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a single perl file and its only dependancies are perl, the perl module Date::Calc (which is probably already installed on your system) and the proper location of a Postfix log file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 2 ways to install pflogsumm :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 1 : ==&lt;br /&gt;
&lt;br /&gt;
Step 1: To get started you first need to download the pflogsumm.pl perl script.&lt;br /&gt;
&lt;br /&gt;
    Download pflogsumm.pl here.&lt;br /&gt;
&lt;br /&gt;
Step 2: Extract the files from the tar ball and put _only_ the perl script pflogsumm.pl into /usr/local/bin/ . Make sure the permissions are 700 for security.&lt;br /&gt;
&lt;br /&gt;
Step 3: get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 2: ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
install pflogsumm &lt;br /&gt;
&lt;br /&gt;
get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
== &lt;br /&gt;
INSTALL A NEW CRONTAB FOR GETTING REGULAR UPDATE OF EACH DAYS MAIL STATISTICS&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
59 23  * * * /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log | mail -s &amp;quot;pflogsumm report &amp;quot; root@localhost&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1405</id>
		<title>Main Page/postfix mail statistics</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/postfix_mail_statistics&amp;diff=1405"/>
		<updated>2013-09-05T11:05:05Z</updated>

		<summary type="html">&lt;p&gt;Hemant: Created page with &amp;quot;&amp;#039;&amp;#039;&amp;#039;Postfix mail statistics via log analyzer&amp;#039;&amp;#039;&amp;#039;   Pflogsumm is a log analyzer for Postfix. The generated report can show you patterns in email traffic so you can better determi...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Postfix mail statistics via log analyzer&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a log analyzer for Postfix. The generated report can show you patterns in email traffic so you can better determine bandwidth limitations, mail server abusers or if your mail server needs to be upgraded. &lt;br /&gt;
&lt;br /&gt;
Statistics can be very helpful in showing, for example, when most of your mail is sent or received or if that one mail user is sending out more than their fair share of mail. &lt;br /&gt;
&lt;br /&gt;
Pflogsumm is a single perl file and its only dependancies are perl, the perl module Date::Calc (which is probably already installed on your system) and the proper location of a Postfix log file.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are 2 ways to install pflogsumm :&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 1 : ==&lt;br /&gt;
&lt;br /&gt;
Step 1: To get started you first need to download the pflogsumm.pl perl script.&lt;br /&gt;
&lt;br /&gt;
    Download pflogsumm.pl here.&lt;br /&gt;
&lt;br /&gt;
Step 2: Extract the files from the tar ball and put _only_ the perl script pflogsumm.pl into /usr/local/bin/ . Make sure the permissions are 700 for security.&lt;br /&gt;
&lt;br /&gt;
Step 3: get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== process 2: ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
install pflogsumm &lt;br /&gt;
&lt;br /&gt;
get statistics out of logs :&lt;br /&gt;
   /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log &lt;br /&gt;
&lt;br /&gt;
== &lt;br /&gt;
INSTALL A NEW CRONTAB FOR GETTING REGULAR UPDATE OF EACH DAYS MAIL STATISTICS&lt;br /&gt;
 ==&lt;br /&gt;
&lt;br /&gt;
59 23  * * * /usr/local/bin/pflogsumm -u 5 -h 5 -d today /var/log/mail.log | mail -s &amp;quot;pflogsumm report &amp;quot; root@localhost&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/Add_rules_in_spamassasin_for_spam_tagging&amp;diff=1389</id>
		<title>Main Page/Add rules in spamassasin for spam tagging</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/Add_rules_in_spamassasin_for_spam_tagging&amp;diff=1389"/>
		<updated>2013-08-17T05:03:10Z</updated>

		<summary type="html">&lt;p&gt;Hemant: /* A few short words about the behavior of the &amp;quot;score&amp;quot; command */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== To reduce spam we need to add rules in spamassassin ==&lt;br /&gt;
&lt;br /&gt;
This can be achieve by tuning spamassassin and applying / adding rules for effective spam filtering. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For some cases only whitelisting and blacklisting of domain does not help . hence we need custom rules for such cases. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== where to write the rules : ==&lt;br /&gt;
 &lt;br /&gt;
/etc/mail/spamassassin/local.cf&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Writing basic rules ==&lt;br /&gt;
&lt;br /&gt;
== Body rules : ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These rules search the body of the message with a regular expression and if it matches, the corresponding score is assigned. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
body EXAMPLE_RULE /test/&lt;br /&gt;
score EXAMPLE_RULE 0.1&lt;br /&gt;
describe EXAMPLE_RULE This is a simple test rule &lt;br /&gt;
&lt;br /&gt;
This rule does a simple case-sensitive search of the body of the email for the string &amp;quot;test&amp;quot; and adds a 0.1 to the score of the email if it finds it&lt;br /&gt;
It will match &amp;quot;test&amp;quot; but also &amp;quot;testing&amp;quot; and &amp;quot;attest&amp;quot;&lt;br /&gt;
In regular expressions a \b can be used to indicate where a word-break (anything that isn&#039;t an alphanumeric character or underscore) must exist for a match. Our rule above can be made to not match &amp;quot;testing&amp;quot; or &amp;quot;attest&amp;quot; like so:&lt;br /&gt;
&lt;br /&gt;
body EXAMPLE_RULE /\btest\b/ &lt;br /&gt;
&lt;br /&gt;
The rule can also be made case-insensitive by adding an i to the end, like this:&lt;br /&gt;
&lt;br /&gt;
body EXAMPLE_RULE /\btest\b/i&lt;br /&gt;
score EXAMPLE_RULE 0.1&lt;br /&gt;
&lt;br /&gt;
Now the rule will match any combination of upper or lower case that spells &amp;quot;test&amp;quot; surrounded by word breaks of some form. &lt;br /&gt;
&lt;br /&gt;
== Header rules ==&lt;br /&gt;
&lt;br /&gt;
Header rules let you check a message header for a string. Most commonly these rules check the Subject, From, or To, but they can be written to check any message header, including non-standard ones&lt;br /&gt;
fOR SUBJECT RULES :&lt;br /&gt;
header EXAMPLE_SUBJECT Subject =~ /\btest\b/i&lt;br /&gt;
score EXAMPLE_SUBJECT 0.1 &lt;br /&gt;
&lt;br /&gt;
The above rule will match a subject: line containing &amp;quot;test&amp;quot; or a SUBJECT: line containing &amp;quot;test&amp;quot;. The first part before the =~ indicates what the name of the header you want to check &lt;br /&gt;
&lt;br /&gt;
Checking the From: line, or any other header, works much the same:&lt;br /&gt;
&lt;br /&gt;
header EXAMPLE_FROM From =~ /test\.com/i&lt;br /&gt;
score EXAMPLE_FROM 0.1 &lt;br /&gt;
&lt;br /&gt;
== THERE WAS A CASE WHERE SPAM USED TO COME FROM DIFFRENT DOMAINS OF SIMILAR NAME ( MYJAMANA 1 , MYJAMAN2, MYJAMANA3, MYJAMANA4 ETC.) FOR THIS THE FROM RULE IS APPLICABLE  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There&#039;s also an option to look at all the headers and match if any of them contain the specified regex:&lt;br /&gt;
&lt;br /&gt;
header LOCAL_DEMONSTRATION_ALL ALL =~ /test\.com/i&lt;br /&gt;
score LOCAL_DEMONSTRATION_ALL 0.1&lt;br /&gt;
&lt;br /&gt;
Not very commonly used, but this feature can also be used to do a case-sensitive check on a header name (it will look at the whole lines, not just the parts after the colon)&lt;br /&gt;
&lt;br /&gt;
header LOCAL_DEMONSTRATION_WEIRD_FROM ALL =~ /^FrOM\:/ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A few short words about the behavior of the &amp;quot;score&amp;quot; command  ==&lt;br /&gt;
    rules with a score set to 0 are not evaluated at all.&lt;br /&gt;
    rules with no score statement will be scored at 1.0, unless 3 or 4 is true&lt;br /&gt;
    rules starting with a double __ are evaluated with no score, and are intended for use in meta rules where you don&#039;t want the sub-rules to have a score.&lt;br /&gt;
    although intended for the sa development effort, any rule starting with T_ will be treated as a &amp;quot;test&amp;quot; rule and will be run with a score of 0.01 (nearly 0). This can be handy when testing rules so you don&#039;t have to create score lines for them if you think you&#039;re not going to keep them.&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
	<entry>
		<id>https://wiki.tetrain.com/index.php?title=Main_Page/Add_rules_in_spamassasin_for_spam_tagging&amp;diff=1387</id>
		<title>Main Page/Add rules in spamassasin for spam tagging</title>
		<link rel="alternate" type="text/html" href="https://wiki.tetrain.com/index.php?title=Main_Page/Add_rules_in_spamassasin_for_spam_tagging&amp;diff=1387"/>
		<updated>2013-08-16T06:25:29Z</updated>

		<summary type="html">&lt;p&gt;Hemant: Created page with &amp;quot; == To reduce spam we need to add rules in spamassasin ==  . This can be achieve by tuning spamassasin and applying / adding rules for effective spam filtering.   ---- For som...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
== To reduce spam we need to add rules in spamassasin ==&lt;br /&gt;
 .&lt;br /&gt;
This can be achieve by tuning spamassasin and applying / adding rules for effective spam filtering. &lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
For some cases only whitelisting and blacklisting of domain does not help . hence we need coustom rules for such cases. &lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== where to write the rules : ==&lt;br /&gt;
 &lt;br /&gt;
/etc/mail/spamassassin/local.cf&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
== Writing basic rules ==&lt;br /&gt;
&lt;br /&gt;
== Body rules : ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
These rules search the body of the message with a regular expression and if it matches, the corresponding score is assigned. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
body EXAMPLE_RULE /test/&lt;br /&gt;
score EXAMPLE_RULE 0.1&lt;br /&gt;
describe EXAMPLE_RULE This is a simple test rule &lt;br /&gt;
&lt;br /&gt;
This rule does a simple case-sensitive search of the body of the email for the string &amp;quot;test&amp;quot; and adds a 0.1 to the score of the email if it finds it&lt;br /&gt;
It will match &amp;quot;test&amp;quot; but also &amp;quot;testing&amp;quot; and &amp;quot;attest&amp;quot;&lt;br /&gt;
In regular expressions a \b can be used to indicate where a word-break (anything that isn&#039;t an alphanumeric character or underscore) must exist for a match. Our rule above can be made to not match &amp;quot;testing&amp;quot; or &amp;quot;attest&amp;quot; like so:&lt;br /&gt;
&lt;br /&gt;
body EXAMPLE_RULE /\btest\b/ &lt;br /&gt;
&lt;br /&gt;
The rule can also be made case-insensitive by adding an i to the end, like this:&lt;br /&gt;
&lt;br /&gt;
body EXAMPLE_RULE /\btest\b/i&lt;br /&gt;
score EXAMPLE_RULE 0.1&lt;br /&gt;
&lt;br /&gt;
Now the rule will match any combination of upper or lower case that spells &amp;quot;test&amp;quot; surrounded by word breaks of some form. &lt;br /&gt;
&lt;br /&gt;
== Header rules ==&lt;br /&gt;
&lt;br /&gt;
Header rules let you check a message header for a string. Most commonly these rules check the Subject, From, or To, but they can be written to check any message header, including non-standard ones&lt;br /&gt;
fOR SUBJECT RULES :&lt;br /&gt;
header EXAMPLE_SUBJECT Subject =~ /\btest\b/i&lt;br /&gt;
score EXAMPLE_SUBJECT 0.1 &lt;br /&gt;
&lt;br /&gt;
The above rule will match a subject: line containing &amp;quot;test&amp;quot; or a SUBJECT: line containing &amp;quot;test&amp;quot;. The first part before the =~ indicates what the name of the header you want to check &lt;br /&gt;
&lt;br /&gt;
Checking the From: line, or any other header, works much the same:&lt;br /&gt;
&lt;br /&gt;
header EXAMPLE_FROM From =~ /test\.com/i&lt;br /&gt;
score EXAMPLE_FROM 0.1 &lt;br /&gt;
&lt;br /&gt;
== THERE WAS A CASE WHERE SPAM USED TO COME FROM DIFFRENT DOMAINS OF SIMILAR NAME ( MYJAMANA 1 , MYJAMAN2, MYJAMANA3, MYJAMANA4 ETC.) FOR THIS THE FROM RULE IS APPLICABLE  ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There&#039;s also an option to look at all the headers and match if any of them contain the specified regex:&lt;br /&gt;
&lt;br /&gt;
header LOCAL_DEMONSTRATION_ALL ALL =~ /test\.com/i&lt;br /&gt;
score LOCAL_DEMONSTRATION_ALL 0.1&lt;br /&gt;
&lt;br /&gt;
Not very commonly used, but this feature can also be used to do a case-sensitive check on a header name (it will look at the whole lines, not just the parts after the colon)&lt;br /&gt;
&lt;br /&gt;
header LOCAL_DEMONSTRATION_WEIRD_FROM ALL =~ /^FrOM\:/ &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== A few short words about the behavior of the &amp;quot;score&amp;quot; command  ==&lt;br /&gt;
    rules with a score set to 0 are not evaluated at all.&lt;br /&gt;
    rules with no score statement will be scored at 1.0, unless 3 or 4 is true&lt;br /&gt;
    rules starting with a double __ are evaluated with no score, and are intended for use in meta rules where you don&#039;t want the sub-rules to have a score.&lt;br /&gt;
    although intended for the sa development effort, any rule starting with T_ will be treated as a &amp;quot;test&amp;quot; rule and will be run with a score of 0.01 (nearly 0). This can be handy when testing rules so you don&#039;t have to create score lines for them if you think you&#039;re not going to keep them. &lt;br /&gt;
&lt;br /&gt;
    rules with a score set to 0 are not evaluated at all.&lt;br /&gt;
    rules with no score statement will be scored at 1.0, unless 3 or 4 is true&lt;br /&gt;
    rules starting with a double __ are evaluated with no score, and are intended for use in meta rules where you don&#039;t want the sub-rules to have a score.&lt;br /&gt;
    although intended for the sa development effort, any rule starting with T_ will be treated as a &amp;quot;test&amp;quot; rule and will be run with a score of 0.01 (nearly 0). This can be handy when testing rules so you don&#039;t have to create score lines for them if you think you&#039;re not going to keep them.&lt;/div&gt;</summary>
		<author><name>Hemant</name></author>
	</entry>
</feed>