Thursday, 8 December 2011

How to install MRTG under Linux


!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

[root@caretel ~]# yum install mrtg net-snmp-utils net-snmp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* epel: ftp.cuhk.edu.hk
* base: centos.aol.in
* updates: centos.aol.in
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package net-snmp.i386 1:5.3.2.2-14.el5_7.1 set to be updated
--> Processing Dependency: net-snmp-libs = 1:5.3.2.2-14.el5_7.1 for package: net-snmp
--> Processing Dependency: libsensors.so.3 for package: net-snmp
---> Package net-snmp-utils.i386 1:5.3.2.2-14.el5_7.1 set to be updated
---> Package mrtg.i386 0:2.14.5-2 set to be updated
--> Processing Dependency: perl-IO-Socket-INET6 for package: mrtg
--> Processing Dependency: perl-Socket6 for package: mrtg
--> Running transaction check
---> Package lm_sensors.i386 0:2.10.7-9.el5 set to be updated
---> Package perl-Socket6.i386 0:0.19-3.fc6 set to be updated
---> Package perl-IO-Socket-INET6.noarch 0:2.51-2.fc6 set to be updated
---> Package net-snmp-libs.i386 1:5.3.2.2-14.el5_7.1 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================
Package Arch Version Repository Size
=============================================================================================================================
Installing:
mrtg i386 2.14.5-2 CentOS 841 k
net-snmp i386 1:5.3.2.2-14.el5_7.1 updates 702 k
net-snmp-utils i386 1:5.3.2.2-14.el5_7.1 updates 190 k
Updating:
net-snmp-libs i386 1:5.3.2.2-14.el5_7.1 updates 1.3 M
Installing for dependencies:
lm_sensors i386 2.10.7-9.el5 base 511 k
perl-IO-Socket-INET6 noarch 2.51-2.fc6 base 13 k
perl-Socket6 i386 0.19-3.fc6 base 22 k

Transaction Summary
=============================================================================================================================
Install 6 Package(s)
Update 1 Package(s)
Remove 0 Package(s)

Total download size: 3.5 M
Is this ok [y/N]: y
Downloading Packages:
(1/7): perl-IO-Socket-INET6-2.51-2.fc6.noarch.rpm | 13 kB 00:00
(2/7): perl-Socket6-0.19-3.fc6.i386.rpm | 22 kB 00:00
(3/7): net-snmp-utils-5.3.2.2-14.el5_7.1.i386.rpm | 190 kB 00:00
(4/7): lm_sensors-2.10.7-9.el5.i386.rpm | 511 kB 00:07
(5/7): net-snmp-5.3.2.2-14.el5_7.1.i386.rpm | 702 kB 00:03
(7/7): net-snmp-libs-5.3.2.2-14.el5_7.1.i386.rpm | 1.3 MB 00:06
-----------------------------------------------------------------------------------------------------------------------------
Total 163 kB/s | 3.5 MB 00:21
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : net-snmp-libs [1/8]
Installing : perl-Socket6 [2/8]
Installing : lm_sensors [3/8]
Installing : net-snmp [4/8]
Installing : net-snmp-utils [5/8]
Installing : perl-IO-Socket-INET6 [6/8]
Installing : mrtg [7/8]
Cleanup : net-snmp-libs [8/8]

Installed: mrtg.i386 0:2.14.5-2 net-snmp.i386 1:5.3.2.2-14.el5_7.1 net-snmp-utils.i386 1:5.3.2.2-14.el5_7.1
Dependency Installed: lm_sensors.i386 0:2.10.7-9.el5 perl-IO-Socket-INET6.noarch 0:2.51-2.fc6 perl-Socket6.i386 0:0.19-3.fc6
Updated: net-snmp-libs.i386 1:5.3.2.2-14.el5_7.1
Complete!

# First take BackUp of origional file.

#cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.origional

#vi /etc/snmp/snmpd.conf
# Change this Line:-
com2sec notConfigUser default public

# New Line
com2sec local localhost public

com2sec mynetwork 11.0.0.2/8 public

# Change this Line:-
group notConfigGroup v1 notConfigUser

group notConfigGroup v2c notConfigUser

# New Line

group MyRWGroup v1 local

group MyRWGroup v2c local

group MyRWGroup usm local

group MyROGroup v1 mynetwork

group MyROGroup v2c mynetwork

group MyROGroup usm mynetwork

# Change this Line:-
view systemview included .1.3.6.1.2.1.1

view systemview included .1.3.6.1.2.1.25.1.1

# New Line

view all included .1 80

# Change this Line:-
access notConfigGroup "" any noauth exact systemview none none

# New Line

access MyROGroup "" any noauth exact all none none

access MyRWGroup "" any noauth exact all all none

# Change this Line:-
syslocation Unknown (edit /etc/snmp/snmpd.conf)

syscontact Root (configure /etc/snmp/snmp.local.conf)

# New Line

syslocation Linux, CentOS, Fedora Core 6

syscontact Root root@localhost

#/etc/init.d/snmpd start

#chkconfig snmpd on


[root@caretel ~]# snmpwalk -v 1 -c public localhost IP-MIB::ipAdEntIfIndex

IP-MIB::ipAdEntIfIndex.11.0.0.2 = INTEGER: 3
IP-MIB::ipAdEntIfIndex.127.0.0.1 = INTEGER: 1
IP-MIB::ipAdEntIfIndex.172.16.10.3 = INTEGER: 2

# mkdir /var/www/html/mrtg/

# cfgmaker --global "workdir: /var/wwwhtml/mrtg" -ifref=ip --output /etc/mrtg/mrtg.cfg --global 'options[_]: growright,bits' public@localhost

# indexmaker --output=/var/www/html/mrtg/index.html /etc/mrtg/mrtg.cfg

# vi /etc/httpd/conf.d/mrtg.conf

Change HtmlDir:- /var/www/html
:wq

[root@caretel ~]# mrtg /etc/mrtg/mrtg.cfg
-----------------------------------------------------------------------
ERROR: Mrtg will most likely not work properly when the environment
variable LANG is set to UTF-8. Please run mrtg in an environment
where this is not the case. Try the following command to start:

env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
-----------------------------------------------------------------------



[root@caretel ~]# env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup could not read the primary log file for localhost_172.16.10.3
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup The backup log file for localhost_172.16.10.3 was invalid as well
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup Can't remove localhost_172.16.10.3.old updating log file
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup Can't rename localhost_172.16.10.3.log to localhost_172.16.10.3.old updating log file
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup could not read the primary log file for localhost_11.0.0.2
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup The backup log file for localhost_11.0.0.2 was invalid as well
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup Can't remove localhost_11.0.0.2.old updating log file
08-12-2011 13:04:23, Rateup WARNING: /usr/bin/rateup Can't rename localhost_11.0.0.2.log to localhost_11.0.0.2.old updating log file

# http://127.0.0.1/mrtg
# http://172.16.10.3/mrtg
# http://11.0.0.2/mrtg

Wednesday, 7 December 2011

MRTG ERROR

You don't have permission to access /mrtg on this server
Was getting following error message

Forbidden
You don't have permission to access /mrtg/ on this server.
--------------------------------------------------------------------------------
Apache/2.0.52 Port 80
I checked the logs @ /var/log/httpd

-rw-r--r-- 1 root root 10368 Apr 16 13:52 error_log

Found following lines

Directory index forbidden by rule:
client denied by server configuration: /var/www/mrtg

Do follwoing steps to fix the issue

To restart the Apapche server use this command httpd -k restart

In /etc/httpd/conf.d

more mrtg.conf
#
# This configuration file maps the mrtg output (generated daily)
# into the URL space. By default these results are only accessible
# from the local host.
#
Alias /mrtg /var/www/html/mrtg

<Location /mrtg>
Order allow,deny
Allow from all
Allow from 127.0.0.1
Allow from ::1
# Allow from .example.com
</Location>


In /etc/httpd/conf


<Directory "/var/www/mrtg">
Order allow,deny
Allow from all
</Directory>

<Directory "/var/www/html/mrtg">
Order allow,deny
Allow from all
</Directory>

DocumentRoot "/var/www/html"
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "/var/www/html">

#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs-2.0/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks

#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride None

#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all

</Directory>

#
# Load config files from the config directory "/etc/httpd/conf.d".
#
Include conf.d/*.conf

Wednesday, 30 November 2011

Steps to Conigure FreePBX

[root@localhost ~]# yum install asterisk14-addons-mysql-*
Loaded plugins: fastestmirror, kmod
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* epel: ftp.cuhk.edu.hk
* epel-source: ftp.cuhk.edu.hk
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package asterisk14-addons-mysql.i386 0:1.4.13-2_centos5 set to be updated
--> Processing Dependency: asterisk14-addons-core = 1.4.13-2_centos5 for package: asterisk14-addons-mysql
--> Running transaction check
---> Package asterisk14-addons-core.i386 0:1.4.13-2_centos5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package Arch Version Repository Size
================================================================================
Installing:
asterisk14-addons-mysql i386 1.4.13-2_centos5 asterisk-current 26 k
Installing for dependencies:
asterisk14-addons-core i386 1.4.13-2_centos5 asterisk-current 31 k

Transaction Summary
================================================================================
Install 2 Package(s)
Upgrade 0 Package(s)

Total download size: 57 k
Is this ok [y/N]: y
Downloading Packages:
(1/2): asterisk14-addons-mysql-1.4.13-2_centos5.i386.rpm | 26 kB 00:01
(2/2): asterisk14-addons-core-1.4.13-2_centos5.i386.rpm | 31 kB 00:00
--------------------------------------------------------------------------------
Total 17 kB/s | 57 kB 00:03
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : asterisk14-addons-core 1/2
Installing : asterisk14-addons-mysql 2/2

Installed:
asterisk14-addons-mysql.i386 0:1.4.13-2_centos5

Dependency Installed:
asterisk14-addons-core.i386 0:1.4.13-2_centos5

Complete!

FreePBX Configuration in El5


[root@localhost ~]# yum repolist
Loaded plugins: fastestmirror, kmod
Loading mirror speeds from cached hostfile
* base: ftp.iitm.ac.in
* epel: ftp.cuhk.edu.hk
* epel-source: ftp.cuhk.edu.hk
* extras: ftp.iitm.ac.in
* updates: ftp.iitm.ac.in
repo id repo name status
addons CentOS-5 - Addons enabled: 0
asterisk-current CentOS-5 - Asterisk - Current enabled: 1,178
base CentOS-5 - Base enabled: 2,705
digium-current CentOS-5 - Digium - Current enabled: 405
epel Extra Packages for Enterprise Linux 5 - i386 enabled: 5,517
epel-source Extra Packages for Enterprise Linux 5 - i386 - S enabled: 3,247
extras CentOS-5 - Extras enabled: 285
updates CentOS-5 - Updates enabled: 341
repolist: 13,678