|
|
|
|
Noob Centos Admin
()
|
|
|||||||||||||||
|
I was running MRTG 2.15.2 on Centos 5.2 without problems for a while.
Over the weekend, I updated Centos to 5.3 and somehow it broke MRTG. I started getting emails from crond with the following errors 2009-07-12 08:45:02: WARNING: Problem with External get '/var/www/html/mrtg/core/system network eth0': Expected a Number for 'in' but got 'p' 2009-07-12 08:45:02: ERROR: Target[index][_IN_] ' $target->[0]{$mode} ' did not eval into defined data The graphs were still updating at this point, however I didn't really want to see error mails every 5 minutes, nor did I think it would be smart to simply redirect crond output to null for mrtg. After searching and reading, I updated mrtg to 2.16.2 as well as added the parameters ENV LANG=C to the crontab line. After this, MRTG stopped updating the statistics logs. However, there are no error messages whatsoever. I've tried installing net-snmp, tested it was working then enabled snmpv3 but doesn't seem to help I've even changed all permissions in /var/html/mrtg to 555 just in case it was some strange permissions issue. The file mrtg.ok is updated on every run but zero length. Config file contents (without comment lines): WorkDir: /var/www/html/mrtg/core Logdir: /var/www/html/mrtg Interval: 5 Options[_]: bits, growright EnableSnmpV3: yes crontab line : */5 * * * * root env LANG=C /usr/local/mrtg-2/bin/mrtg /var/www/html/mrtg/core/mrtg.cfg --logging /var/log/mrtg.log entry in log: 2009-07-12 11:35:02 -- Started mrtg with config '/var/www/html/mrtg/core/mrtg.cfg' Every single entry is just that, I'm not sure if there should be a line that says "Ended mrtg" or something to that effect. I'll appreciate any help on solving this, thanks in advanced! _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Rafael Possamai
()
|
|
|
Hi,
Try changing permissions to 777 just to make sure that is not the problem. (chmod -R 777 dir). If it doesn't help, put if back to 555. And also, check if something has changed in the scripts' outputs (mrtg-load, etc)... And last thing: the permissions have to be according to what user and group mrtg is being ran under.
Hope anything of these things help. On Sun, Jul 12, 2009 at 12:45 AM, Noob Centos Admin <[hidden email]> wrote: I was running MRTG 2.15.2 on Centos 5.2 without problems for a while. _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
||
|
|
Noob Centos Admin
()
|
|
|||||||||||||||
|
Hi,
On Sun, Jul 12, 2009 at 3:31 PM, Rafael Possamai<[hidden email]> wrote: > Hi, > Try changing permissions to 777 just to make sure that is not the problem. > (chmod -R 777 dir). If it doesn't help, put if back to 555. And also, check > if something has changed in the scripts' outputs (mrtg-load, etc)... And > last thing: the permissions have to be according to what user and group mrtg > is being ran under. > Hope anything of these things help. I've tried the 777 as well as chown /var/html/www/mrtg to root but nothing changes. I've been tracking the time stamps on the mrtg output but they have remained unchanged since the last update before it stopped working. I've redone the config and removed the 0 byte mrtg.ok which I understand is the config cache. But nothing changes the outcome. I've also tried using the --debug and --check options but it doesn't shed any clue, MRTG appears to be working as it expects. Is there a way to see what MRTG thinks it's getting from SNMP? I'm also curious how does MRTG tell which "router" is it supposed to get information from? This is because although I specify the router as public@localhost, the CFG file does not appear to tell MRTG this. Lastly, what is the behaviour if MRTG is unable to get an output from SNMP or unable to understand the output from SNMP? Would it throw an error or simply exit without updating? Thanks! _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Noob Centos Admin
()
|
|
|||||||||||||||
|
In reply to this post
by Rafael Possamai
Hi,
> 1. it is pretty simple to work with. you just have to set up a mrtg.cfg file > and it should work fine even when you have a very minimal configuration. > 2. permissions are something that may botter you if there's even one file > that the daemon can't read/write/execute, but it should be easy to fix when > you have access to log files. > 3. try setting up the options for a log directory. add the following line to > your conf file if you don't have one like that yet: > Logdir: /etc/mrtg/logs > make sure the path exists and has the proper permissions. > 4. make sure that mrtg is being ran under root user and group. if you change > mrtg's user and group you will have to change all those permissions again. > 5. use -R with chmod when you change permissions of directories with files > on it, so it will apply for everything, not only the main directory your > working with. e.g.: chmod -R 777 /etc/mrtg /var/html/www/mrtg/ > 6. backup all your data from /var/html/www/mrtg/ and delete it from there > and try to run mrtg as it was it's first time being ran. I mv away the existing mrtg directory in my /var/html/www directory, then used cfgmaker public@localhost to create a most minimal cfg file, adding only the Workdir and Logdir. Basically apart from comment lines, there appears only to be 3 effective lines, e.g. workdir, logdir and EnableIPv6: no The mrtg binary files and the output directories are all under root currently, permissions on everything in the output folder to 777 to eliminate any potential permissions problem. Running from command line, the same thing happens. MRTG recreates the missing MRTG header pictures in the workdir, including the zero byte mrtg.ok (is this supposed to be zero byte?). However, no log files are created in the log folder. Logging is done, I had tail -f on the file and updates accordingly with no error message whatsoever. <pre> 2009-07-12 21:59:53 -- Started mrtg with config '/var/www/html/mrtg/core/mrtg.cfg' 2009-07-12 21:59:53 -- --base: Creating Lockfiles /var/www/html/mrtg/core/mrtg.cfg_l,/var/www/html/mrtg/core/mrtg.cfg_l_21308 2009-07-12 21:59:53 -- --base: Reading Config File: /var/www/html/mrtg/core/mrtg.cfg 2009-07-12 21:59:53 -- --base: Reading Interface Config cache 2009-07-12 21:59:53 -- --base: Checking Config File 2009-07-12 21:59:53 -- --base: Loading default Locale 2009-07-12 21:59:53 -- --base: Starting main Loop 2009-07-12 21:59:53 -- --base: Populate Target object by polling SNMP and external Datasources 2009-07-12 21:59:53 -- --base: Exit main Loop 2009-07-12 21:59:53 -- --base: Remove Lock Files 2009-07-12 21:59:53 -- --base: Store Interface Config Cache </pre> I tried add an example from http://net-snmp.sourceforge.net/wiki/index.php/TUT:MRTG where it uses more advanced MRTG commands with SNMP to monitor CPU usage. This had the effect of MRTG logging SNMP errors, specifically, the log file now show actual attempt to get data from SNMP. So this makes me wonder if the default setup wasn't working and MRTG was not even polling for data due to some unknown problem. Is there some way to make MRTG tell what data it is seeing or is it getting any data when trying to get the default data like load and network traffic? _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Rafael Possamai
()
|
|
|||||||||||||||
|
I assumed your SNMP+MRTG was set up correctly... But now that you changed it and it worked (or at least tried to gather data from it) I think that maybe something was going on with SNMP. On my server I take all the data from shell scripts, for example:
mrtg-load (memory and cpu) mrtg-ip-acct (e.g. eth0) Once I took data from sensors (lm-sensors) and it was working fine. After I rebooted the server I noticed it stopped showing any new data with no error messages. What happened was that the output was always 0 because the modules for lm-sensors weren't loaded. So maybe your SNMP was giving MRTG useless data like null/zero.
Here is a script for memory/cpu script: http://www.ext3.com.br/cpu.sh wget that, chmod +x cpu.sh and the lines for it on mrtg.cfg should look something like this:
-------- # Performance Target[perf]:`/path/to/cpu.sh` Title[perf]:"Average cpu load and memory use" PageTop[perf]:"<h1>Average cpu load and memory use</h1>"
Options[perf]: growright,gauge,nopercent,noinfo,nobanner YLegend[perf]: Percentual ShortLegend[perf]: % MaxBytes[perf]: 100 Legend1[perf]: CPU Load Legend2[perf]: Memory use
LegendI[perf]: Load LegendO[perf]: Mem -------- If it works just fine... I would say your problem is at the snmp set up. Rafael. On Sun, Jul 12, 2009 at 11:14 AM, Noob Centos Admin <[hidden email]> wrote: Hi, _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Noob Centos Admin
()
|
|
|||||||||||||||
|
Hi,
On Sun, Jul 12, 2009 at 10:48 PM, Rafael Possamai<[hidden email]> wrote: > I assumed your SNMP+MRTG was set up correctly... But now that you changed it > and it worked (or at least tried to gather data from it) I think that maybe > something was going on with SNMP. Thanks for the script, I added it to MRTG and as you figured, something must have gone wrong in the latest update. MRTG started creating the log files and graphs. Although the data is wrong, I looked at the loads and it's all zeros, at least now I know what I should be trying to fix. Now working on fixing SNMP, and it appears that despite it working, somehow it was not actually loading up the required MIBs, or at least that's my understanding. So far I've managed to get SNMP to report cpu load. >snmpwalk -v 1 -c public localhost laTable UCD-SNMP-MIB::laIndex.1 = INTEGER: 1 UCD-SNMP-MIB::laIndex.2 = INTEGER: 2 UCD-SNMP-MIB::laIndex.3 = INTEGER: 3 UCD-SNMP-MIB::laNames.1 = STRING: Load-1 UCD-SNMP-MIB::laNames.2 = STRING: Load-5 UCD-SNMP-MIB::laNames.3 = STRING: Load-15 UCD-SNMP-MIB::laLoad.1 = STRING: 0.10 UCD-SNMP-MIB::laLoad.2 = STRING: 0.18 UCD-SNMP-MIB::laLoad.3 = STRING: 0.17 UCD-SNMP-MIB::laConfig.1 = STRING: 12.00 UCD-SNMP-MIB::laConfig.2 = STRING: 12.00 UCD-SNMP-MIB::laConfig.3 = STRING: 12.00 UCD-SNMP-MIB::laLoadInt.1 = INTEGER: 10 UCD-SNMP-MIB::laLoadInt.2 = INTEGER: 17 UCD-SNMP-MIB::laLoadInt.3 = INTEGER: 17 UCD-SNMP-MIB::laLoadFloat.1 = Opaque: Float: 0.100000 UCD-SNMP-MIB::laLoadFloat.2 = Opaque: Float: 0.180000 UCD-SNMP-MIB::laLoadFloat.3 = Opaque: Float: 0.170000 UCD-SNMP-MIB::laErrorFlag.1 = INTEGER: 0 UCD-SNMP-MIB::laErrorFlag.2 = INTEGER: 0 UCD-SNMP-MIB::laErrorFlag.3 = INTEGER: 0 UCD-SNMP-MIB::laErrMessage.1 = STRING: UCD-SNMP-MIB::laErrMessage.2 = STRING: UCD-SNMP-MIB::laErrMessage.3 = STRING: But then this leads me back to MRTG... how do I get MRTG to do the default pages again? Right now, the only way I could get anything generated was to follow the example from snmp wiki and manually add lines like this LoadMIBs: /usr/local/share/snmp/mibs/UCD-SNMP-MIB.txt Target[load]:laLoadInt.1&laLoadInt.2&laLoadInt.3:public@localhost RouterUptime[load]: public@localhost MaxBytes[load]: 100 Title[load]: CPU LOAD PageTop[load]: <H1>CPU Load %</H1> Unscaled[load]: ymwd ShortLegend[load]: % YLegend[load]: CPU Utilization Legend1[load]: 1 Minute (Load) Legend2[load]: 5 Minute (Load) Legend3[load]: 15 Minute (Load) LegendI[load]: User LegendO[load]: System Options[load]: growright,nopercent This gives me the load.html but the graphs are not what I expect, I'm still trying to find if there's an equivalent to RouterUptime for cpu load. Thanks again for pointing me in the right direction! _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Rafael Possamai
()
|
|
|||||||||||||||
|
I think that script has accurate data, at least on my debian lenny. It gets the load average, not the current load. And memory it will take buffers/cache data. It is really simple though.
About SNMP, I have never used it. I was actually going to start figuring it out because it is more reliable and gives you out way more data. I would suggest you to take a look here:
If you must take the data from the snmp, I guess you will have to figure it out, but if you are just using this "for fun" or for curiosity, try some of those scripts, its much easier (not that I'm lazy, hehehe).
Regards, Rafael On Sun, Jul 12, 2009 at 12:53 PM, Noob Centos Admin <[hidden email]> wrote: Hi, _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Noob Centos Admin
()
|
|
|||||||||||||||
|
Hi,
On Mon, Jul 13, 2009 at 12:41 AM, Rafael Possamai<[hidden email]> wrote: > I think that script has accurate data, at least on my debian lenny. It gets > the load average, not the current load. And memory it will take > buffers/cache data. It is really simple though. Sorry, I wasn't implying your script was faulty in anyway. Quite obviously the problem is my setup isn't reporting the right values because I screw up somewhere and your script proves that both MRTG and it is executing correctly, just that my server is giving them garbage data to work with. > About SNMP, I have never used it. I was actually going to start figuring it > out because it is more reliable and gives you out way more data. I would > suggest you to take a look here: > http://vegan.net/MRTG/concepts.php > http://ruleoftech.wordpress.com/2007/06/18/quick-howto-setting-up-snmp-and-mrtg/ Thanks for the links, the 2nd one looks really useful! > If you must take the data from the snmp, I guess you will have to figure it > out, but if you are just using this "for fun" or for curiosity, try some of > those scripts, its much easier (not that I'm lazy, hehehe). Unfortunately I'll have to figure it out soon. Hopefully the scripts from the second link would work when plugged straight in and buy me time to figure things out. I'm still bewildered by how on earth did I get MRTG to work before the update, since I didn't had to do a thing to the config file previously. Thanks yet again for your valuable help! :) _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
|
|
Noob Centos Admin
()
|
|
|||||||||||||||
|
Hi,
>> http://ruleoftech.wordpress.com/2007/06/18/quick-howto-setting-up-snmp-and-mrtg/ Unfortunately the examples here didn't work either. MRTG keeps complaining that the variable are unknown in SNMP debugging. I eventually discovered other people with similar problems and could only be resolved by using the numeric OID instead of the easier to remember names. Now the problem is figuring out how do get MRTG to display the values as expected. Along the way I found this pretty nice guide for MRTG http://www.linuxhomenetworking.com/wiki/index.php/Quick_HOWTO_:_Ch23_:_Advanced_MRTG_for_Linux However, following the examples there and adjusting them to fit my peculiar setup, I find that MRTG is still not showing the values as expected. If I use laLoadInt, MRTG apparently treats it as some decimal value, so all I ever see is a load of 1%. If I use laLoad, I get 0% throughout If I use ssCpuRawUser or something, I get a something 10x what I expect Still experimenting with different formulas to see if I can finally get something sensible to show up. [whine] This has taken so much time, I'm almost about to just write a PHP script to grab values from an exec("snmpwalk") and dump them into a mysql database. There might be a chance I get that done faster than figuring all the nuances in the MRTG and SNMP interactions. :( [/whine] It just doesn't make sense that I have to jump through so many hoops just to get MRTG to work by default. Surely there must be just one single error in the very early stage that I could correct and viola MRTG works without anything else in the cfg file? _______________________________________________ mrtg mailing list [hidden email] https://lists.oetiker.ch/cgi-bin/listinfo/mrtg |
|||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |