SlideShare a Scribd company logo
1 of 13
jChaart
WEB DASHBOARD LIBRARY
OMAR AL ZABIR.COM
BT
Transaction Stats
Server stats
https://github.com/oazabir/jChaart
How it works – Push vs Pull
Dashboard Webserver
Windows
Linux
Solaris
MS SQL Server
MySql
Oracle
External Web API
Example data
00:00|Completed|582|black
00:00|Last week Completed|357|grey
00:00|Last week Error|1|red
00:00|New|10|yellow
01:00|New|22|yellow
01:00|Last week Error|19|red
01:00|Last week New|8|ivory
01:00|Last week Completed|3322|grey
01:00|Completed|2742|black
01:00|Error|9|brown
02:00|Error|23|brown
02:00|Completed|1906|black
02:00|Last week Completed|1845|grey
02:00|Last week New|2|ivory
02:00|Last week Error|13|red
02:00|New|23|yellow
jChaart.build({ id: '#OnlineOrderWeekComparison',
urls: "data/transactions/Online_week_comparison.txt“
});
Producing Transaction Stats via SQL
SET NOCOUNT ON
;WITH Status_CTE (Axis, Label, Value, Color)
AS
(
SELECT
-- This gives the hour of the day, eg 08:00
convert(nvarchar,DATEPART(hour,GetDate()),2)+':'+
Right('00' +
convert(nvarchar,DATEPART(minute,GetDate()),2), 2)
AS Axis,
CASE Status
when 4 then 'Completed'
when 5 then 'Failed'
END as Label,
count(*) as Value,
CASE Status
when 4 then 'green'
when 5 then 'yellow'
END as Color
FROM Orders WITH (NOLOCK)
WHERE Created BETWEEN dateadd(DAY,0,
datediff(day,0, GETDATE())) AND
dateadd(DAY,1, datediff(day,0, GETDATE()))
GROUP BY Status
)
SELECT
Axis,
Label,
SUM(Value) as Value,
Color
FROM Status_CTE
GROUP BY Axis, Label, Color;
sqlcmd -S myserver.com -U user -P pass -d
dbname -i .xxxx_stats.sql -h-1 -s"|" -w 700 -W
-o xxxx_stats.txt
How data looks like
15:15|22.02|75.73|0.90
15:16|23.04|75.62|0.22
15:17|0.81|5.15|62.87
15:18|0.00|4.71|60.99
15:19|0.00|0.75|0.00
15:20|0.25|1.00|0.00
15:21|0.50|1.00|0.00
15:22|0.25|0.50|0.00
15:23|0.25|0.75|0.00
15:24|0.00|1.27|0.00
Producing System Stats
FILENAME=`hostname`_cpu.txt
sar -u 1 1 | tail -2 | head -n1 | awk '{print
substr($1,0,5)"|"$3"|"$5"|"$6}' >> $FILENAME
tail -10 $FILENAME > $FILENAME.tmp
mv $FILENAME.tmp $FILENAME
ftp -n -i myserver.com <<End-of-Session
user myserver.com|transactiondata "Transaction2014"
put $FILENAME
bye
End-of-Session
EOF
Real-time DB monitoring
When it hit the fan
Web server traffic monitoring
awk -F',' '{ if( NF > 7 ) { hour=substr($4,0,2); name=$8; time=0 + $9; key=hour" "name;
totals[key]+=time; count[key]+=1; if (mins[key] != "") { if (time > mins[key]) { } else { mins[key] =
time;} } else { mins[key] = time; } if (maxs[key] != "") { if (time < maxs[key]) { } else { maxs[key] =
time;} } else { maxs[key] = time; } } } END{ for (k in count) { hour = substr(k, 0, index(k, " ")-1);
name= substr(k, index(k, " ")+1); avg = totals[k]/count[k]; print
hour"|"name"|"count[k]"|"avg"|"mins[k]"|"maxs[k]"|" } }' apacheLog.txt | sort > output.txt
Demo Time
Q&A
 Difficult questions not to ask
 Why would I use this and not that?
 How is it better than Nagios or similar monitoring tools?

More Related Content

What's hot

2012 07 making disqus realtime@euro python
2012 07 making disqus realtime@euro python2012 07 making disqus realtime@euro python
2012 07 making disqus realtime@euro python
Adam Hitchcock
 
Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 Lt
Shinichi Ogawa
 

What's hot (19)

DJUGL - Django and AWS Lambda
DJUGL - Django and AWS LambdaDJUGL - Django and AWS Lambda
DJUGL - Django and AWS Lambda
 
Consul administration at scale
Consul administration at scaleConsul administration at scale
Consul administration at scale
 
Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...
Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...
Tim Panton - Presentation at Emerging Communications Conference & Awards (eCo...
 
Why Grails?
Why Grails?Why Grails?
Why Grails?
 
What's new in Ansible 2.0
What's new in Ansible 2.0What's new in Ansible 2.0
What's new in Ansible 2.0
 
GCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow IntroductionGCPUG meetup 201610 - Dataflow Introduction
GCPUG meetup 201610 - Dataflow Introduction
 
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience SharingClickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
Clickhouse MeetUp@ContentSquare - ContentSquare's Experience Sharing
 
CDN on GKE with Ingress
CDN on GKE with IngressCDN on GKE with Ingress
CDN on GKE with Ingress
 
Ansible with AWS
Ansible with AWSAnsible with AWS
Ansible with AWS
 
Actor Based Asyncronous IO in Akka
Actor Based Asyncronous IO in AkkaActor Based Asyncronous IO in Akka
Actor Based Asyncronous IO in Akka
 
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
Elasticsearch (R)Evolution — You Know, for Search… by Philipp Krenn at Big Da...
 
2012 07 making disqus realtime@euro python
2012 07 making disqus realtime@euro python2012 07 making disqus realtime@euro python
2012 07 making disqus realtime@euro python
 
Appengine Java Night #2 Lt
Appengine Java Night #2 LtAppengine Java Night #2 Lt
Appengine Java Night #2 Lt
 
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
[Kotlin Serverless 工作坊] 單元 4 - 實作 RSS Aggregator
 
ClickHouse new features and development roadmap, by Aleksei Milovidov
ClickHouse new features and development roadmap, by Aleksei MilovidovClickHouse new features and development roadmap, by Aleksei Milovidov
ClickHouse new features and development roadmap, by Aleksei Milovidov
 
Finagle - an intro to rpc & a sync programming in jvm
Finagle - an intro to rpc & a sync programming in jvmFinagle - an intro to rpc & a sync programming in jvm
Finagle - an intro to rpc & a sync programming in jvm
 
Everything ruby
Everything rubyEverything ruby
Everything ruby
 
Rails Scripts
Rails ScriptsRails Scripts
Rails Scripts
 
Gemless
GemlessGemless
Gemless
 

Viewers also liked (11)

Test on clauses
Test on clausesTest on clauses
Test on clauses
 
Salisbury_Dentato
Salisbury_DentatoSalisbury_Dentato
Salisbury_Dentato
 
Pop up menu ujian
Pop up menu ujianPop up menu ujian
Pop up menu ujian
 
Tips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC ApplicationsTips and Tricks For Faster Asp.NET and MVC Applications
Tips and Tricks For Faster Asp.NET and MVC Applications
 
Scaling asp.net websites to millions of users
Scaling asp.net websites to millions of usersScaling asp.net websites to millions of users
Scaling asp.net websites to millions of users
 
Animals vocabulary
Animals vocabularyAnimals vocabulary
Animals vocabulary
 
Passive Voice
Passive VoicePassive Voice
Passive Voice
 
If Clause / Conditional Sentence
If Clause / Conditional SentenceIf Clause / Conditional Sentence
If Clause / Conditional Sentence
 
Conditionals
ConditionalsConditionals
Conditionals
 
Conditional Sentences + If
Conditional Sentences + IfConditional Sentences + If
Conditional Sentences + If
 
10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites10 performance and scalability secrets of ASP.NET websites
10 performance and scalability secrets of ASP.NET websites
 

Similar to jChaart - Web Dashboard Framework

fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
Wesley Beary
 
1404 app dev series - session 8 - monitoring & performance tuning
1404   app dev series - session 8 - monitoring & performance tuning1404   app dev series - session 8 - monitoring & performance tuning
1404 app dev series - session 8 - monitoring & performance tuning
MongoDB
 
Live Streaming & Server Sent Events
Live Streaming & Server Sent EventsLive Streaming & Server Sent Events
Live Streaming & Server Sent Events
tkramar
 
Monitoring and analytics with was liberty
Monitoring and analytics with was libertyMonitoring and analytics with was liberty
Monitoring and analytics with was liberty
sflynn073
 

Similar to jChaart - Web Dashboard Framework (20)

fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
fog or: How I Learned to Stop Worrying and Love the Cloud (OpenStack Edition)
 
FMK2019 being an optimist in a pessimistic world by vincenzo menanno
FMK2019 being an optimist in a pessimistic world by vincenzo menannoFMK2019 being an optimist in a pessimistic world by vincenzo menanno
FMK2019 being an optimist in a pessimistic world by vincenzo menanno
 
fog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloudfog or: How I Learned to Stop Worrying and Love the Cloud
fog or: How I Learned to Stop Worrying and Love the Cloud
 
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry PiMonitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
Monitoring Your ISP Using InfluxDB Cloud and Raspberry Pi
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
1404 app dev series - session 8 - monitoring & performance tuning
1404   app dev series - session 8 - monitoring & performance tuning1404   app dev series - session 8 - monitoring & performance tuning
1404 app dev series - session 8 - monitoring & performance tuning
 
Live Streaming & Server Sent Events
Live Streaming & Server Sent EventsLive Streaming & Server Sent Events
Live Streaming & Server Sent Events
 
Monitoring and analytics with was liberty
Monitoring and analytics with was libertyMonitoring and analytics with was liberty
Monitoring and analytics with was liberty
 
Beyond php - it's not (just) about the code
Beyond php - it's not (just) about the codeBeyond php - it's not (just) about the code
Beyond php - it's not (just) about the code
 
Best Practices in Handling Performance Issues
Best Practices in Handling Performance IssuesBest Practices in Handling Performance Issues
Best Practices in Handling Performance Issues
 
Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理Digdagによる大規模データ処理の自動化とエラー処理
Digdagによる大規模データ処理の自動化とエラー処理
 
OrientDB
OrientDBOrientDB
OrientDB
 
MySQL Cookbook: Recipes for Developers, Alkin Tezuysal and Sveta Smirnova - P...
MySQL Cookbook: Recipes for Developers, Alkin Tezuysal and Sveta Smirnova - P...MySQL Cookbook: Recipes for Developers, Alkin Tezuysal and Sveta Smirnova - P...
MySQL Cookbook: Recipes for Developers, Alkin Tezuysal and Sveta Smirnova - P...
 
MySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for DevelopersMySQL Cookbook: Recipes for Developers
MySQL Cookbook: Recipes for Developers
 
Monitoring MySQL with OpenTSDB
Monitoring MySQL with OpenTSDBMonitoring MySQL with OpenTSDB
Monitoring MySQL with OpenTSDB
 
Automate Your FME Server Installs, Take a Five Minute Break
Automate Your FME Server Installs, Take a Five Minute BreakAutomate Your FME Server Installs, Take a Five Minute Break
Automate Your FME Server Installs, Take a Five Minute Break
 
Master tuning
Master   tuningMaster   tuning
Master tuning
 
Setting Up a TIG Stack for Your Testing
Setting Up a TIG Stack for Your TestingSetting Up a TIG Stack for Your Testing
Setting Up a TIG Stack for Your Testing
 
Cutting through the fog of cloud
Cutting through the fog of cloudCutting through the fog of cloud
Cutting through the fog of cloud
 

jChaart - Web Dashboard Framework

  • 5. How it works – Push vs Pull Dashboard Webserver Windows Linux Solaris MS SQL Server MySql Oracle External Web API
  • 6. Example data 00:00|Completed|582|black 00:00|Last week Completed|357|grey 00:00|Last week Error|1|red 00:00|New|10|yellow 01:00|New|22|yellow 01:00|Last week Error|19|red 01:00|Last week New|8|ivory 01:00|Last week Completed|3322|grey 01:00|Completed|2742|black 01:00|Error|9|brown 02:00|Error|23|brown 02:00|Completed|1906|black 02:00|Last week Completed|1845|grey 02:00|Last week New|2|ivory 02:00|Last week Error|13|red 02:00|New|23|yellow jChaart.build({ id: '#OnlineOrderWeekComparison', urls: "data/transactions/Online_week_comparison.txt“ });
  • 7. Producing Transaction Stats via SQL SET NOCOUNT ON ;WITH Status_CTE (Axis, Label, Value, Color) AS ( SELECT -- This gives the hour of the day, eg 08:00 convert(nvarchar,DATEPART(hour,GetDate()),2)+':'+ Right('00' + convert(nvarchar,DATEPART(minute,GetDate()),2), 2) AS Axis, CASE Status when 4 then 'Completed' when 5 then 'Failed' END as Label, count(*) as Value, CASE Status when 4 then 'green' when 5 then 'yellow' END as Color FROM Orders WITH (NOLOCK) WHERE Created BETWEEN dateadd(DAY,0, datediff(day,0, GETDATE())) AND dateadd(DAY,1, datediff(day,0, GETDATE())) GROUP BY Status ) SELECT Axis, Label, SUM(Value) as Value, Color FROM Status_CTE GROUP BY Axis, Label, Color; sqlcmd -S myserver.com -U user -P pass -d dbname -i .xxxx_stats.sql -h-1 -s"|" -w 700 -W -o xxxx_stats.txt
  • 8. How data looks like 15:15|22.02|75.73|0.90 15:16|23.04|75.62|0.22 15:17|0.81|5.15|62.87 15:18|0.00|4.71|60.99 15:19|0.00|0.75|0.00 15:20|0.25|1.00|0.00 15:21|0.50|1.00|0.00 15:22|0.25|0.50|0.00 15:23|0.25|0.75|0.00 15:24|0.00|1.27|0.00
  • 9. Producing System Stats FILENAME=`hostname`_cpu.txt sar -u 1 1 | tail -2 | head -n1 | awk '{print substr($1,0,5)"|"$3"|"$5"|"$6}' >> $FILENAME tail -10 $FILENAME > $FILENAME.tmp mv $FILENAME.tmp $FILENAME ftp -n -i myserver.com <<End-of-Session user myserver.com|transactiondata "Transaction2014" put $FILENAME bye End-of-Session EOF
  • 11. Web server traffic monitoring awk -F',' '{ if( NF > 7 ) { hour=substr($4,0,2); name=$8; time=0 + $9; key=hour" "name; totals[key]+=time; count[key]+=1; if (mins[key] != "") { if (time > mins[key]) { } else { mins[key] = time;} } else { mins[key] = time; } if (maxs[key] != "") { if (time < maxs[key]) { } else { maxs[key] = time;} } else { maxs[key] = time; } } } END{ for (k in count) { hour = substr(k, 0, index(k, " ")-1); name= substr(k, index(k, " ")+1); avg = totals[k]/count[k]; print hour"|"name"|"count[k]"|"avg"|"mins[k]"|"maxs[k]"|" } }' apacheLog.txt | sort > output.txt
  • 13. Q&A  Difficult questions not to ask  Why would I use this and not that?  How is it better than Nagios or similar monitoring tools?