summaryrefslogtreecommitdiffstats
path: root/plugins/impstats/statslog-graph.py
diff options
context:
space:
mode:
authorAndre Lorbach <alorbach@adiscon.com>2013-07-03 13:21:46 +0200
committerAndre Lorbach <alorbach@adiscon.com>2013-07-03 13:21:46 +0200
commit7b16f5c49766fb8d08835e2f2839d4514dc29f9a (patch)
tree707e2d4a3615fd70d883fc3e920d21b59bdeb81b /plugins/impstats/statslog-graph.py
parent1d22bd58d4a19d63294fb89f4f7a054e7220074a (diff)
downloadrsyslog-7b16f5c49766fb8d08835e2f2839d4514dc29f9a.tar.gz
rsyslog-7b16f5c49766fb8d08835e2f2839d4514dc29f9a.tar.bz2
rsyslog-7b16f5c49766fb8d08835e2f2839d4514dc29f9a.zip
Finished statslog graph and splitter script.
Also added needed javascript files, so they can be included into the svg files. This removes dependencies on external sources. The statslog-splitter can now automatically generated SVG or PNG charts together with an index.html in the output directory. This helps taking a quick view on all generated stats data.
Diffstat (limited to 'plugins/impstats/statslog-graph.py')
-rwxr-xr-xplugins/impstats/statslog-graph.py41
1 files changed, 23 insertions, 18 deletions
diff --git a/plugins/impstats/statslog-graph.py b/plugins/impstats/statslog-graph.py
index 7ac62b0a..2892283e 100755
--- a/plugins/impstats/statslog-graph.py
+++ b/plugins/impstats/statslog-graph.py
@@ -148,20 +148,18 @@ else:
# if nLineCount > 25:
# break
- if nMaxDataCount > 0:
- # Check if we need to reduce the data amount
- nTotalDataCount = len( aData[aFields[0]] )
- nDataStepCount = nTotalDataCount / (nMaxDataCount)
- if nTotalDataCount > nMaxDataCount:
- for iDataNum in reversed(range(0, nTotalDataCount)):
- # Remove all entries who
- if iDataNum % nDataStepCount == 0:
- aMajorXData.append( aData[aFields[0]][iDataNum] )
-# for field in aFields:
-# aData[field].pop(iDataNum)
+# if nMaxDataCount > 0:
+# # Check if we need to reduce the data amount
+# nTotalDataCount = len( aData[aFields[0]] )
+# nDataStepCount = nTotalDataCount / (nMaxDataCount)
+# if nTotalDataCount > nMaxDataCount:
+# for iDataNum in reversed(range(0, nTotalDataCount)):
+# # Remove all entries who
+# if iDataNum % nDataStepCount == 0:
+# aMajorXData.append( aData[aFields[0]][iDataNum] )
-# print len(aMajorXData)
-# sys.exit(0)
+ # Import Style
+# from pygal.style import LightSolarizedStyle
# Create Config object
from pygal import Config
@@ -175,25 +173,32 @@ else:
chartCfg.x_label_rotation = 45
chartCfg.include_x_axis = True
chartCfg.show_dots=False
- chartCfg.show_minor_x_labels=False
+ if nMaxDataCount > 0:
+ chartCfg.show_minor_x_labels=False
+ chartCfg.x_labels_major_count=nMaxDataCount
+ chartCfg.js = [ 'svg.jquery.js','pygal-tooltips.js' ] # Use script from local
+# chartCfg.style = LightSolarizedStyle
+ chartCfg.print_values = False
+ chartCfg.print_zeroes = True
+ chartCfg.no_data_text = "All values are 0"
#chartCfg.logarithmic=True # Makes chart more readable
-
- #Linechart
+ # Create Linechart
if bLineChart:
myChart = pygal.Line(chartCfg)
myChart.title = 'Line Chart of "' + szInput + '"'
myChart.x_title = "Time elasped in seconds"
myChart.x_labels = map(str, aData[aFields[0]] )
- myChart.x_labels_major = map(str, aMajorXData )
+# myChart.x_labels_major = map(str, aMajorXData )
for iChartNum in range(3, len(aFields) ):
myChart.add(aFields[iChartNum], aData[ aFields[iChartNum] ]) # Add some values
+ # Create BarChart
elif bBarChart:
myChart = pygal.Bar(chartCfg)
myChart.title = 'Bar Chart of "' + szInput + '"'
myChart.x_title = "Time elasped in seconds"
myChart.x_labels = map(str, aData[aFields[0]] )
- myChart.x_labels_major = map(str, aMajorXData )
+# myChart.x_labels_major = map(str, aMajorXData )
for iChartNum in range(3, len(aFields) ):
myChart.add(aFields[iChartNum], aData[ aFields[iChartNum] ]) # Add some values