Difference between revisions of "Google charts"

From SME Server
Jump to navigationJump to search
(Created page with "{{Level|Medium}} {{usefulnote}} ==About== "[https://developers.google.com/chart/?hl=en Charts] Google chart tools are powerful, simple to use, and free. Try out our rich galle...")
 
Line 8: Line 8:
 
==Forum discussion==
 
==Forum discussion==
 
This how-to can be discussed on the forums [http://forums.contribs.org/index.php/topic,52107.0.html here]
 
This how-to can be discussed on the forums [http://forums.contribs.org/index.php/topic,52107.0.html here]
 +
 +
The rational for behind this is :
 +
You have a database / source of information that you would like to graph. In this instance, I needed to see in fairly real-time, the number of http processes as well as the size of these processes.
 +
 +
It could be applied to a multitude of scenarios.
 +
 +
==Getting Started==
 +
 +
1.Prepare the collection of the relevant parameters that you want to monitor ( in this case, http stats )
 +
create a shell script:
 +
#/usr/bin
 +
 +
while true
 +
do
 +
LOG=outlog.txt
 +
OUTPUT=$(ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print ":Average Proccess Size (MB): "x/((y-1)*1024)}' && echo -n ':Apache Processes: ' && ps -C httpd --no-headers | wc -l  )
 +
#DAY=$(date +"%F %H:%M:%S")
 +
DAY=$(date +"%F"+"%T")
 +
now=$(date +'%Y-%m-%d %H:%M:%S')
 +
 +
##echo $OUTPUT \'$DAY\'
 +
echo $OUTPUT \'$DAY\' | awk  '{print "INSERT INTO performance (mem_used, process_size, processors_used,period) VALUES  ( "$5", "$10", "$13", "$14" );"}' | mysql --user=username --password=password database_name
 +
sleep 120
 +
done

Revision as of 21:09, 26 November 2015

PythonIcon.png Skill level: Medium
The instructions on this page require a basic knowledge of linux.


Is this article helpful to you?
Please consider donating or volunteering
Thank you!

About

"Charts Google chart tools are powerful, simple to use, and free. Try out our rich gallery of interactive charts and data tools.


Forum discussion

This how-to can be discussed on the forums here

The rational for behind this is : You have a database / source of information that you would like to graph. In this instance, I needed to see in fairly real-time, the number of http processes as well as the size of these processes.

It could be applied to a multitude of scenarios.

Getting Started

1.Prepare the collection of the relevant parameters that you want to monitor ( in this case, http stats ) create a shell script:

  1. /usr/bin

while true do LOG=outlog.txt OUTPUT=$(ps -ylC httpd | awk '{x += $8;y += 1} END {print "Apache Memory Usage (MB): "x/1024; print ":Average Proccess Size (MB): "x/((y-1)*1024)}' && echo -n ':Apache Processes: ' && ps -C httpd --no-headers | wc -l )

  1. DAY=$(date +"%F %H:%M:%S")

DAY=$(date +"%F"+"%T") now=$(date +'%Y-%m-%d %H:%M:%S')

    1. echo $OUTPUT \'$DAY\'

echo $OUTPUT \'$DAY\' | awk '{print "INSERT INTO performance (mem_used, process_size, processors_used,period) VALUES ( "$5", "$10", "$13", "$14" );"}' | mysql --user=username --password=password database_name sleep 120 done