| Cheshire Cat Computing http://steveshipway.org/forum/ |
|
| plotting multiple values http://steveshipway.org/forum/viewtopic.php?f=11&t=1063 |
Page 1 of 1 |
| Author: | technicalx [ Thu Feb 15, 2007 6:43 am ] |
| Post subject: | plotting multiple values |
I'm back at the knowledge well, asking for more help. I have mrtg up and running great...capturing router stats and server stats. For the servers, I found a dude who uses vbscripts to pull the WMI data from windows servers. works great, too. question I have is how to plot multiple values on the graphs vs. just the in/out values. for example, I would like to plot the cpu load for a server that reports values for 4 cpu's. when using the following .cfg settings, I can only grab the first two. what file do I need to make changes to for allowing more than in/out, assign a separate color for each value and how? I'm actually shooting for a graph similar to what NTOP displays with 8 - 12 variables plotted on one graph. ============================================== Ylegend[AD0.wmi.cpuload]: % Disk Used Options[AD0.wmi.cpuload]: growright,gauge Target[AD0.wmi.cpuload]: `cscript.exe //nologo scripts/test/cpuload.vbs` MaxBytes[AD0.wmi.cpuload]: 100 Title[AD0.wmi.cpuload]: ad0: CPU load balancing ShortLegend[AD0.wmi.cpuload]: % Legend1[AD0.wmi.cpuload]: CPU 0 Legend2[AD0.wmi.cpuload]: CPU 1 Legend3[AD0.wmi.cpuload]: CPU 2 Legend4[AD0.wmi.cpuload]: CPU 3 LegendI[AD0.wmi.cpuload]: % load: LegendO[AD0.wmi.cpuload]: % load: # Legend3I[AD0.wmi.cpuload]: % load: # Legend4O[AD0.wmi.cpuload]: % load: PageTop[AD0.wmi.cpuload]: <H1>ad0 - CPU Loading</H1> ======================================== the vbscript I use to pull the load values On Error Resume Next Const wbemFlagReturnImmediately = &h10 Const wbemFlagForwardOnly = &h20 arrComputers = Array("ad0") For Each strComputer In arrComputers ' WScript.Echo ' WScript.Echo "==========================================" ' WScript.Echo "Computer: " & strComputer ' WScript.Echo "==========================================" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", _ wbemFlagReturnImmediately + wbemFlagForwardOnly) For Each objItem In colItems WScript.Echo objItem.LoadPercentage Next Next Function WMIDateStringToDate(dtmDate) WScript.Echo dtm: WMIDateStringToDate = CDate(Mid(dtmDate, 5, 2) & "/" & _ Mid(dtmDate, 7, 2) & "/" & Left(dtmDate, 4) _ & " " & Mid (dtmDate, 9, 2) & ":" & Mid(dtmDate, 11, 2) & ":" & Mid(dtmDate,13, 2)) End Function ============================================== The values derived from the vbscript 38 18 0 2 thanx in advance!!! |
|
| Author: | Rednarb [ Thu Feb 15, 2007 7:07 am ] |
| Post subject: | |
What you'll have to do is set up individual 2-item targets, then combine them using Routers2. Basically, the "real" targets just gather data but you tell routers2 to only draw the custom graph that includes all the real data. See http://www.steveshipway.org/software/rrd/doc/EXAMPLES It took me several tries to get it right but I finally was able to make my own custom graphs. Keep tweaking at it and it will come to you. |
|
| Author: | stevesh [ Thu Feb 15, 2007 9:43 am ] |
| Post subject: | |
Another way to grab data from Windows boxes is to install pNSclient (or one of its cousins, nsclient++ or NC_Net) and then use the mrtg-pnsclient script in the routers2 extras directory to query the values held in it. The way to achieve what you want is, as previously stated, to make a Userdefined Summary graph. This can combine multiple targets and display totals or averages (see the Incoming/Outgoing graphs for a look at what they look like). You can suppress the component graphs using routers.cgi*InMenu[xxxx]: no so that only the summary graph is visible in the menu, if you want, or put them into summary pages with routers.cgi*Summary[xxxx]: summaryname and remove them from the default summary with routers.cgi*InSummary[xxxx]: no Defining Userdefined Summary graphs is done with routers.cgi*Graph[xxxx]: summarygraphname options... on each Target you want to be a member of the graph. Options can be things line 'withtotal', 'noo' and so on - see the MRTG_INFO documentation for the full syntax of the routers.cgi*Graph directive. The doc/EXAMPLES file (there is a more recent one distributed with routers than the one available online) shows you how to make userdefined graphs and summaries. Also, if you go to the demo server on steveshipway.org, then you can view the .cfg files - so see the .cfg file for the Linux server monitoring, which contains a userdefined graph for the CPU stats. |
|
| Author: | technicalx [ Wed Feb 28, 2007 5:51 am ] |
| Post subject: | |
Steve, being a "hack first, then read the instructions" type of guy, I did get the graphs to show on the right pane of the page. It even had the graph correct when I clicked on the link! So, THANK YOU, Mr. Shipway!! Now I'm running into an annoyance, due to the CSCRIPT being run instead of SNMP strings. If I use 'perl mrtg bes1.cfg --logging=bes1.log' from a command prompt or from CRON, the perl process starts but I never get updates. I've tried 'start /d perl .......' but using start doesn't help. the logs indicate 2007-02-26 16:54:20 -- WARNING: Could not get any data from external command 'cscript.exe //nologo scripts/BES1/diskque.vbs' Maybe the external command did not even start. () 2007-02-26 16:54:20 -- WARNING: Problem with External get 'cscript.exe //nologo scripts/BES1/diskque.vbs': Expected a Number for 'in' but nothing' 2007-02-26 16:54:20 -- WARNING: Problem with External get 'cscript.exe //nologo scripts/BES1/diskque.vbs': Expected a Number for 'out' but nothing' BUT, if I stop the CRON and kill perl then delete any *.cfg_l files in the bin directory, I can run 'wperl mrtg bes1.cfg --logging=bes1.cfg'. All is good and the scripts run. Problem is, these DOS windows pop up for each running of cscript. I've googled 'wperl' to find any switches that might surpress these DOS boxes, but haven't found much. I know you are not a windows advocate, but thought I might pass this by you. thanx for making me look good! |
|
| Author: | stevesh [ Wed Feb 28, 2007 9:30 am ] |
| Post subject: | |
It may be a problem caused by your PATH variable, or your current directory. Try giving the path to your scripts as an absolute path -- eg, E:\foo\scripts\thingy rather than scripts\thingy and see if this works better. I've had this sort of issue under UNIX. |
|
| Page 1 of 1 | All times are UTC + 12 hours [ DST ] |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|