Wednesday 17 December, 2008

MRTG SNMP config

yum install mrtg

snmpconf -g basic_setup


[root@tansen ~]# snmpconf -g basic_setup

The following installed configuration files were found:

1: /etc/snmp/snmpd.conf
2: /etc/snmp/snmptrapd.conf

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

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

Read in which (default = all):
************************************************
*** Beginning basic system information setup ***
************************************************
Do you want to configure the information returned in the system MIB group (contact info, etc)? (default = y):

Configuring: syslocation
Description:
The [typically physical] location of the system.
Note that setting this value here means that when trying to
perform an snmp SET operation to the sysLocation.0 variable will make
the agent return the "notWritable" error code. IE, including
this token in the snmpd.conf file will disable write access to
the variable.
arguments: location_string

The location of the system:

Finished Output: syslocation

Configuring: syscontact
Description:
The contact information for the administrator
Note that setting this value here means that when trying to
perform an snmp SET operation to the sysContact.0 variable will make
the agent return the "notWritable" error code. IE, including
this token in the snmpd.conf file will disable write access to
the variable.
arguments: contact_string

The contact information: sukhdev@xlncenterprises.com

Finished Output: syscontact sukhdev@xlncenterprises.com
Do you want to properly set the value of the sysServices.0 OID (if you don't know, just say no)? (default = y):

Configuring: sysservices
Description:
The proper value for the sysServices object.
arguments: sysservices_number

does this host offer physical services (eg, like a repeater) [answer 0 or 1]: 0
does this host offer datalink/subnetwork services (eg, like a bridge): 0
does this host offer internet services (eg, supports IP): 1
does this host offer end-to-end services (eg, supports TCP): 1
does this host offer application services (eg, supports SMTP): 0

Finished Output: sysservices 12
**************************************
*** BEGINNING ACCESS CONTROL SETUP ***
**************************************
Do you want to configure the agent's access control? (default = y):
Do you want to allow SNMPv3 read-write user based access (default = y):

Configuring: rwuser
Description:
a SNMPv3 read-write user
arguments: user [noauth|auth|priv] [restriction_oid]

The SNMPv3 user that should have read-write access: sukhdev
The minimum security level required for that user [noauth|auth|priv, default = auth]:
The OID that this community should be restricted to [if appropriate]:

Finished Output: rwuser sukhdev
Do another rwuser line? (default = y): n
Do you want to allow SNMPv3 read-only user based access (default = y): n
Do you want to allow SNMPv1/v2c read-write community access (default = y):

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

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

Finished Output: rwcommunity public
Do another rwcommunity line? (default = y): n
Do you want to allow SNMPv1/v2c read-only community access (default = y): n
****************************************
*** Beginning trap destination setup ***
****************************************
Do you want to configure where and if the agent will send traps? (default = y):
Do you want the agent to send snmp traps on snmp authentication failures? (default = y):

Configuring: authtrapenable
Description:
Should we send traps when authentication failures occur
arguments: 1 | 2 (1 = yes, 2 = no)

Should traps be sent when authentication failures occur? (1=yes, 2=no): 1

Finished Output: authtrapenable 1

Configuring: trapcommunity
Description:
Default trap sink community to use
arguments: community-string

The default community name to use when sending traps: public

Finished Output: trapcommunity public
Do you want the agent to send snmpv2c informs to a trap receiver (default = y): n
Do you want the agent to send snmpv2c traps to a trap receiver (default = y): n
Do you want the agent to send snmpv1 traps to a trap receiver (default = y): n
****************************************
*** Beginning monitoring setup ***
****************************************
Do you want to configure the agent's ability to monitor various aspects of your system? (default = y):
Do you want to configure the agents ability to monitor processes? (default = y):

Configuring: proc
Description:
Check for processes that should be running.
proc NAME [MAX=0] [MIN=0]

NAME: the name of the process to check for. It must match
exactly (ie, http will not find httpd processes).
MAX: the maximum number allowed to be running. Defaults to 0.
MIN: the minimum number to be running. Defaults to 0.

The results are reported in the prTable section of the UCD-SNMP-MIB tree
Special Case: When the min and max numbers are both 0, it assumes
you want a max of infinity and a min of 1.

Name of the process you want to check on: httpd
Maximum number of processes named 'httpd' that should be running [default = 0]: 1
Minimum number of processes named 'httpd' that should be running [default = 0]: 6

Finished Output: proc httpd 1 6
Do another proc line? (default = y): n
Do you want to configure the agents ability to monitor disk space? (default = y):

Configuring: disk
Description:
Check for disk space usage of a partition.
The agent can check the amount of available disk space, and make
sure it is above a set limit.

disk PATH [MIN=100000]

PATH: mount path to the disk in question.
MIN: Disks with space below this value will have the Mib's errorFlag set.
Can be a raw byte value or a percentage followed by the %
symbol. Default value = 100000.

The results are reported in the dskTable section of the UCD-SNMP-MIB tree

Enter the mount point for the disk partion to be checked on: /
Enter the minimum amount of space that should be available on /: 500m

Finished Output: disk / 500m
Do another disk line? (default = y): n
Do you want to configure the agents ability to monitor load average? (default = y):

Configuring: load
Description:
Check for unreasonable load average values.
Watch the load average levels on the machine.

load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]

1MAX: If the 1 minute load average is above this limit at query
time, the errorFlag will be set.
5MAX: Similar, but for 5 min average.
15MAX: Similar, but for 15 min average.

The results are reported in the laTable section of the UCD-SNMP-MIB tree

Enter the maximum allowable value for the 1 minute load average: 7
Enter the maximum allowable value for the 5 minute load average: 7
Enter the maximum allowable value for the 15 minute load average: 7

Finished Output: load 7 7 7
Do another load line? (default = y): n
Do you want to configure the agents ability to monitor file sizes? (default = y): n


The following files were created:
[root@tansen ~]# snmpconf -g basic_setup

The following installed configuration files were found:

1: /etc/snmp/snmpd.conf
2: /etc/snmp/snmptrapd.conf

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

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

Read in which (default = all):
************************************************
*** Beginning basic system information setup ***
************************************************
Do you want to configure the information returned in the system MIB group (contact info, etc)? (default = y):

Configuring: syslocation
Description:
The [typically physical] location of the system.
Note that setting this value here means that when trying to
perform an snmp SET operation to the sysLocation.0 variable will make
the agent return the "notWritable" error code. IE, including
this token in the snmpd.conf file will disable write access to
the variable.
arguments: location_string

The location of the system:

Finished Output: syslocation

Configuring: syscontact
Description:
The contact information for the administrator
Note that setting this value here means that when trying to
perform an snmp SET operation to the sysContact.0 variable will make
the agent return the "notWritable" error code. IE, including
this token in the snmpd.conf file will disable write access to
the variable.
arguments: contact_string

The contact information: sukhdev@xlncenterprises.com

Finished Output: syscontact sukhdev@xlncenterprises.com
Do you want to properly set the value of the sysServices.0 OID (if you don't know, just say no)? (default = y):

Configuring: sysservices
Description:
The proper value for the sysServices object.
arguments: sysservices_number

does this host offer physical services (eg, like a repeater) [answer 0 or 1]: 0
does this host offer datalink/subnetwork services (eg, like a bridge): 0
does this host offer internet services (eg, supports IP): 1
does this host offer end-to-end services (eg, supports TCP): 1
does this host offer application services (eg, supports SMTP): 0

Finished Output: sysservices 12
**************************************
*** BEGINNING ACCESS CONTROL SETUP ***
**************************************
Do you want to configure the agent's access control? (default = y):
Do you want to allow SNMPv3 read-write user based access (default = y):

Configuring: rwuser
Description:
a SNMPv3 read-write user
arguments: user [noauth|auth|priv] [restriction_oid]

The SNMPv3 user that should have read-write access: sukhdev
The minimum security level required for that user [noauth|auth|priv, default = auth]:
The OID that this community should be restricted to [if appropriate]:

Finished Output: rwuser sukhdev
Do another rwuser line? (default = y): n
Do you want to allow SNMPv3 read-only user based access (default = y): n
Do you want to allow SNMPv1/v2c read-write community access (default = y):

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

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

Finished Output: rwcommunity public
Do another rwcommunity line? (default = y): n
Do you want to allow SNMPv1/v2c read-only community access (default = y): n
****************************************
*** Beginning trap destination setup ***
****************************************
Do you want to configure where and if the agent will send traps? (default = y):
Do you want the agent to send snmp traps on snmp authentication failures? (default = y):

Configuring: authtrapenable
Description:
Should we send traps when authentication failures occur
arguments: 1 | 2 (1 = yes, 2 = no)

Should traps be sent when authentication failures occur? (1=yes, 2=no): 1

Finished Output: authtrapenable 1

Configuring: trapcommunity
Description:
Default trap sink community to use
arguments: community-string

The default community name to use when sending traps: public

Finished Output: trapcommunity public
Do you want the agent to send snmpv2c informs to a trap receiver (default = y): n
Do you want the agent to send snmpv2c traps to a trap receiver (default = y): n
Do you want the agent to send snmpv1 traps to a trap receiver (default = y): n
****************************************
*** Beginning monitoring setup ***
****************************************
Do you want to configure the agent's ability to monitor various aspects of your system? (default = y):
Do you want to configure the agents ability to monitor processes? (default = y):

Configuring: proc
Description:
Check for processes that should be running.
proc NAME [MAX=0] [MIN=0]

NAME: the name of the process to check for. It must match
exactly (ie, http will not find httpd processes).
MAX: the maximum number allowed to be running. Defaults to 0.
MIN: the minimum number to be running. Defaults to 0.

The results are reported in the prTable section of the UCD-SNMP-MIB tree
Special Case: When the min and max numbers are both 0, it assumes
you want a max of infinity and a min of 1.

Name of the process you want to check on: httpd
Maximum number of processes named 'httpd' that should be running [default = 0]: 1
Minimum number of processes named 'httpd' that should be running [default = 0]: 6

Finished Output: proc httpd 1 6
Do another proc line? (default = y): n
Do you want to configure the agents ability to monitor disk space? (default = y):

Configuring: disk
Description:
Check for disk space usage of a partition.
The agent can check the amount of available disk space, and make
sure it is above a set limit.

disk PATH [MIN=100000]

PATH: mount path to the disk in question.
MIN: Disks with space below this value will have the Mib's errorFlag set.
Can be a raw byte value or a percentage followed by the %
symbol. Default value = 100000.

The results are reported in the dskTable section of the UCD-SNMP-MIB tree

Enter the mount point for the disk partion to be checked on: /
Enter the minimum amount of space that should be available on /: 500m

Finished Output: disk / 500m
Do another disk line? (default = y): n
Do you want to configure the agents ability to monitor load average? (default = y):

Configuring: load
Description:
Check for unreasonable load average values.
Watch the load average levels on the machine.

load [1MAX=12.0] [5MAX=12.0] [15MAX=12.0]

1MAX: If the 1 minute load average is above this limit at query
time, the errorFlag will be set.
5MAX: Similar, but for 5 min average.
15MAX: Similar, but for 15 min average.

The results are reported in the laTable section of the UCD-SNMP-MIB tree

Enter the maximum allowable value for the 1 minute load average: 7
Enter the maximum allowable value for the 5 minute load average: 7
Enter the maximum allowable value for the 15 minute load average: 7

Finished Output: load 7 7 7
Do another load line? (default = y): n
Do you want to configure the agents ability to monitor file sizes? (default = y): n


The following files were created:

snmpd.conf

These files should be moved to /usr/share/snmp if you
want them used by everyone on the system. In the future, if you add
the -i option to the command line I'll copy them there automatically for you.

Or, if you want them for your personal use only, copy them to
/root/.snmp . In the future, if you add the -p option to the
command line I'll copy them there automatically for you.


snmpd.conf

These files should be moved to /usr/share/snmp if you
want them used by everyone on the system. In the future, if you add
the -i option to the command line I'll copy them there automatically for you.

Or, if you want them for your personal use only, copy them to
/root/.snmp . In the future, if you add the -p option to the
command line I'll copy them there automatically for you.

cfgmaker --global 'WorkDir: /var/www/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg/tansen.cfg public@192.168.1.2

cfgmaker --global 'WorkDir: /var/www/mrtg' --global 'Options[_]: bits,growright' --output /etc/mrtg/mrtg1.cfg public@192.168.15.1


indexmaker --output=/var/www/mrtg/index.html mrtg1.cfg tansen.cfg
env LANG=C /usr/bin/mrtg tansen.cfg

vim /etc/httpd/conf.d/mrtg.conf

Add folowing lines in the file to avoid errors [Wed Dec 17 12:55:05 2008] [error] [client 127.0.0.1] Directory index forbidden by Options directive: /var/www/mrtg/.


Options Indexes FollowSymLinks

AllowOverride None





service httpd restart


http://localhost/mrtg/