Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Installation/Configuration

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 2nd September 2010, 08:18
gads gads is offline
Junior Member
 
Join Date: Sep 2010
Posts: 5
Thanks: 1
Thanked 1 Time in 1 Post
Default check_mrtgtraf: Unable to open MRTG log file

hi, I have installed nagios on centOS and I monitor switch but the Port1 Bandwidth Usage has this error "check_mrtgtraf: Unable to open MRTG log file ". I had already installed mrtg but it has the same error.
do anyone can help me about this problem? thanks in advance...

here is the script of my switch.cfg:

define service{
use generic-service ; Inherit values from a template
host_name distributed_switch
service_description Port 1 Bandwidth Usage
check_command check_local_mrtgtraf!/var/lib/mrtg/192.168.1.253_1.log!AVG!1000000,1000000!5000000,50 00000!10
}
Reply With Quote
Sponsored Links
  #2  
Old 2nd September 2010, 09:10
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

Code:
ls -al /var/lib/mrtg/192.168.1.253_1.log
Code:
ps flax | grep nagios
Reply With Quote
  #3  
Old 2nd September 2010, 10:16
gads gads is offline
Junior Member
 
Join Date: Sep 2010
Posts: 5
Thanks: 1
Thanked 1 Time in 1 Post
Default

thanks for the reply Mark_NL, when I try the code you gave this is the result:

[root@localhost ~]# ls -al /var/lib/mrtg/192.168.1.253_1.log
ls: /var/lib/mrtg/192.168.1.253_1.log: No such file or directory
[root@localhost ~]# ps flax | grep nagios
0 0 18909 12276 17 0 3916 664 stext S+ pts/0 0:00 | \_ grep nagios
1 100 2860 1 18 0 6780 484 335550 Ss ? 0:00 /usr/sbin/ndo2db -c /etc/nagios/ndo2db.cfg
1 100 16191 2860 15 0 6780 1268 - S ? 0:01 \_ /usr/sbin/ndo2db -c /etc/nagios/ndo2db.cfg
1 100 16188 1 15 0 13716 984 stext Ssl ? 0:00 /usr/bin/nagios -d /etc/nagios/nagios.cfg

I wonder what is 192.168.1.253_1.log because when i go to /var/lib/mrtg/ directory, it is not there? what should i do about this?

thanks in advance..
Reply With Quote
  #4  
Old 2nd September 2010, 10:28
Mark_NL Mark_NL is offline
Senior Member
 
Join Date: Sep 2008
Location: The Netherlands
Posts: 912
Thanks: 12
Thanked 100 Times in 96 Posts
Default

what IS in that mrtg dir?

Code:
ls -al /var/lib/mrtg/
Reply With Quote
  #5  
Old 2nd September 2010, 17:52
kheimbuch kheimbuch is offline
Junior Member
 
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Mark I am having the same problem as Gads. The only file I have in the /var/lib/mrtg/ directory is:

_etc_mrtg.cfg
Reply With Quote
  #6  
Old 3rd September 2010, 04:22
gads gads is offline
Junior Member
 
Join Date: Sep 2010
Posts: 5
Thanks: 1
Thanked 1 Time in 1 Post
Default

hi Mark, thanks for the reply, sorry for the late response... here is the result of the command " ls -al /var/lib/mrtg/ " :

[root@localhost ~]# ls -al /var/lib/mrtg/
total 12
drwxr-xr-x 2 root root 4096 Jan 10 2007 .
drwxrwxr-x 22 apache nagios 4096 Sep 1 13:21 ..
-rw-r--r-- 1 nagios nagios 0 Sep 3 10:15 mrtg.ok
[root@localhost ~]#

what should I do next? thanks in advance...
Reply With Quote
  #7  
Old 3rd September 2010, 15:26
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Can you try
Code:
chown nagios:nagios /var/lib/mrtg/
?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
  #8  
Old 3rd September 2010, 20:32
kheimbuch kheimbuch is offline
Junior Member
 
Join Date: Sep 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nothing for me. Still the same error. I had even tried creating the file itself and giving nagios full access to it.
Reply With Quote
  #9  
Old 4th September 2010, 12:38
falko falko is offline
Super Moderator
 
Join Date: Apr 2005
Location: Lüneburg, Germany
Posts: 41,701
Thanks: 1,900
Thanked 2,721 Times in 2,562 Posts
Default

Does a
Code:
chmod 777 /var/lib/mrtg/
work?
__________________
Falko
--
Download the ISPConfig 3 Manual! | Check out the ISPConfig 3 Billing Module!

FB: http://www.facebook.com/howtoforge

nginx-Webhosting: Timme Hosting | Follow me on:
Reply With Quote
The Following User Says Thank You to falko For This Useful Post:
gads (6th September 2010)
  #10  
Old 6th September 2010, 11:49
gads gads is offline
Junior Member
 
Join Date: Sep 2010
Posts: 5
Thanks: 1
Thanked 1 Time in 1 Post
 
Default

hi, i have solved this problem, this is the things that i did:

Install MRTG:
To monitor bandwidth usages of router/switch you must have mrtg installed on system. Before installation please make sure you have install gd, libpng, zlib packages.

1. Download MRTG using yum install mrtg

2. Now you need not to create mrtg configuration file. Use cfgmaker.
cfgmaker --global 'WorkDir: /var/www/html/mymrtg' --global 'Options[_]: bits,growright' --output /etc/httpd/conf/mrtg.cfg public@<ip address of the switch>
6. Go to respective location and make sure that above command has created respective files.
cd /var/www/html/mrtg;
ls -al /etc/httpd/conf/mrtg.cfg

7. Run this command to update mrtg log file.
env LANG=C /usr/bin/mrtg /etc/mrtg/mrtg.cfg


10. Set cron to run above command every 5 minute.
crontab -e

11. insert the code below and save,
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/mrtg/mymrtg.cfg –logging /var/log/mrtg.log
*/5 * * * * /usr/bin/env LANG=C /usr/bin/mrtg /etc/httpd/conf/mrtg.cfg --logging /var/log/mrtg.log

12. Restart cron service.
/etc/init.d/crond restart

13. Confirm that it is been configured.
http://localhost/mymrtg/{name of html file}

Actually when you run mrtg command it searches for respective router community collects all data from router. Accordingly it creates log file. Like in my case it has found port 2 running on router and hence created file 172.17.42.22_2.log, 172.17.42.22_2.html. So I can access my graph through this link,
http://localhost/mymrtg/<ip address of the switch>_2.html

Procedure to monitor Bandwidth Usages in Nagios:
1. Default installation directory of nagios is /usr/local/nagios/.

2. Open switch.cfg file
nano /etc/nagios/objects/switch.cfg

3. Make changes according to your router specifications. Like,
define host{
use generic-switch
host_name Router_1
alias Router 1
address 172.17.42.22
hostgroups switches
}
4. You can also set PING, Uptime, Ports Link Status etc.
define service{
use generic-service ; Inherit values from a template
host_name Router_1 ; The name of the host the service is associated with
service_description PING ; The service description
check_command check_ping!200.0,20%!600.0,60% ; The command used to monitor the service
normal_check_interval 5 ; Check the service every 5 minutes under normal conditions
retry_check_interval 1 ; Re-check the service every minute until its final/hard state is determined
}

define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Uptime
check_command check_snmp!-C public -o sysUpTime.0 -H 172.17.42.22
}

define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Port 2 Link Status
check_command check_snmp!-C public -o ifOperStatus.2 -r 1 -H 172.17.42.22
}

define service{
use generic-service ; Inherit values from a template
host_name Router_1
service_description Port 2 Bandwidth Usage
check_command check_local_mrtgtraf!/var/www/html/mymrtg/172.17.42.22_2.log!AVG!1000000,1000000!5000000,500 0000!10
}

5. Verify the configuration of nagios
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg

6. Restart nagios service.
/etc/init.d/nagios restart
Reply With Quote
The Following User Says Thank You to gads For This Useful Post:
falko (7th September 2010)
Reply

Bookmarks

Tags
check_mrtgtraf, nagios

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix delivery problem erebus Installation/Configuration 7 26th June 2014 14:33
Can't access to my website - after install problem pallermo Installation/Configuration 18 4th June 2010 13:29
Hosting multiple websites and webmail dmwcool Installation/Configuration 8 30th March 2010 03:15
Mail System doesnt work! crichton Installation/Configuration 3 17th September 2007 23:49
ERROR: The PHP binary coming with ISPConfig does not work properly on your system! qvindesland Installation/Configuration 22 21st May 2007 16:05


All times are GMT +2. The time now is 01:43.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.