LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   php and snmp (http://www.linuxquestions.org/questions/linux-networking-3/php-and-snmp-814735/)

rojoblandino 06-17-2010 10:01 AM

php and snmp
 
Hi guys i was trying mrtg, but when the light go off the graphics get distorted. Trying to adjust the conf files i get nothing than trying rrdtool but i keep having the same problems.

So i was thinking to use php, i got working php snmp walk function but i am looking the way to get the bandwidth or usage of the device from snmp or any snmp function but still now i keep searching.

Once done this stages i would be able to save the data into an array and the plot it into a graph and personalize the max and min values for avoiding distorted graphs.

Any Idea?

TB0ne 06-18-2010 10:30 AM

Quote:

Originally Posted by rojoblandino (Post 4006613)
Hi guys i was trying mrtg, but when the light go off the graphics get distorted. Trying to adjust the conf files i get nothing than trying rrdtool but i keep having the same problems.

So i was thinking to use php, i got working php snmp walk function but i am looking the way to get the bandwidth or usage of the device from snmp or any snmp function but still now i keep searching.

Once done this stages i would be able to save the data into an array and the plot it into a graph and personalize the max and min values for avoiding distorted graphs.
Any Idea?

No...can't follow what you're saying: "trying mrtg, but when the light go off the graphics get distorted"????? What?????

Then you mention PHP and snmpwalk...are you writing your own code? Using what to store the data and graph it?? No idea what your problem is, or what you're trying to do. Best I can figure out, you're trying to graph network utilization. MRTG is the best way to go...if your rrd files got corrupted, then remove and regenerate them, and continue.

Otherwise, you can easily set up Nagios, Zenoss, Big Brother, or any other PHP/web based monitoring tools for bandwith monitoring.

rojoblandino 06-24-2010 10:24 AM

Quote:

Originally Posted by TB0ne (Post 4007669)
No...can't follow what you're saying: "trying mrtg, but when the light go off the graphics get distorted"????? What?????

Then you mention PHP and snmpwalk...are you writing your own code? Using what to store the data and graph it?? No idea what your problem is, or what you're trying to do. Best I can figure out, you're trying to graph network utilization. MRTG is the best way to go...if your rrd files got corrupted, then remove and regenerate them, and continue.

Otherwise, you can easily set up Nagios, Zenoss, Big Brother, or any other PHP/web based monitoring tools for bandwith monitoring.

I have test Nagios, MRTG, Zenoss but none of them solve my problem, my problem is that i can not see the values because the mrtg show a line of 10 MB being the connection of 128kbps so you do not see anything, and erasing the graph does not solve my problem, it get worst because i lost the information, so i just need to get the values of badnwidth.

Of course i am going to save the data somewhere, but i still have doubts and the help in the php home site is a little poor that i can not find the function that would allow me to get the bandwidth value of the device.

Getting that the programation is not problem, my question is what funcions i need to use to get the bandwidth i can not find it on AltaVista or Google.

P.D.: I have tryied to set the MaxValue1 and MaxValue2 and still show the high Lines and distroted the graphic to little lines that you see nothing, just the line, so i am decide to do my script that will respect my MaxValue and if the value is hight than that will not grhaphic or will make a mod(value,MAxvalue) or something like that in gcc it would be something like v2graph=(val%MaxValue); That will allow me to always show the value but will not distorted it and if is mor thant the MaxValue will start from the bottom of the graph.

centosboy 06-25-2010 05:55 AM

Quote:

Originally Posted by rojoblandino (Post 4013700)
I have test Nagios, MRTG, Zenoss but none of them solve my problem, my problem is that i can not see the values because the mrtg show a line of 10 MB being the connection of 128kbps so you do not see anything, and erasing the graph does not solve my problem, it get worst because i lost the information, so i just need to get the values of badnwidth.

Of course i am going to save the data somewhere, but i still have doubts and the help in the php home site is a little poor that i can not find the function that would allow me to get the bandwidth value of the device.

Getting that the programation is not problem, my question is what funcions i need to use to get the bandwidth i can not find it on AltaVista or Google.

P.D.: I have tryied to set the MaxValue1 and MaxValue2 and still show the high Lines and distroted the graphic to little lines that you see nothing, just the line, so i am decide to do my script that will respect my MaxValue and if the value is hight than that will not grhaphic or will make a mod(value,MAxvalue) or something like that in gcc it would be something like v2graph=(val%MaxValue); That will allow me to always show the value but will not distorted it and if is mor thant the MaxValue will start from the bottom of the graph.


i *think* i get what you are saying.
add the MaxBytes directive.

In case i am wrong, please show your mrtg.cfg file.

rojoblandino 06-30-2010 12:41 PM

Quote:

Originally Posted by centosboy (Post 4014583)
i *think* i get what you are saying.
add the MaxBytes directive.

In case i am wrong, please show your mrtg.cfg file.

Here it is
Code:

EnableIPv6: no
WorkDir: /srv/virtual/mrtg-dir

RunAsDaemon: Yes
Language: spanish

WithPeak[_]: dwmy
options[_]: growright, bits, transparent, avgpeak, unknaszero, noborder, pngdate
XSize[_]: 600
YSize[_]: 200
XScale[_]:1.8
YScale[_]:1.5
YTics[_]:12
Unscaled[_]: dwmy
MaxBytes[_]: 128000

But as i have said before the MaxBytes are not working, here i am setting to 1M but when the light go off the mrtg show a line of 10M or more, so the graphics get distorted, i do not want to get distorted graphs and erasing the data do not solve my problem.

Also you can see that Unscaled is set to all, it works when is less than 1M, for example the Y values show the 1M and if 128kbps are being send i can see the 128kbps and the blank space to reach 1M but if more than 1M is sent, for example if light go off a pulse is produced and more than 1M is recieve in the network cards, then it scale the graph, even with the option unscaled, it seems that unscaled work well for values under MaxBytes not over it.

So i am trying to do it by my self to get the values through php save the datas into a file or database and then graph the content, if value is higher than limit do not graph or do something like ($val % limit) it will take the mod of the value and will start from bottom, any way, to do it i have not found how to get the MIB values through php functions, anybody can help me, i am still reading and nothing found.

Thanks.


All times are GMT -5. The time now is 05:26 PM.