31/03/2560

Pentaho CDE DashBoard [Drill-Down ไปยังอีก DashBoard]

Drill-Down ไปยังอีก DashBoard นึง คือการที่เราจะมี 2 DashBoard ซึ่ง DashBoard แรกจะทำหน้าที่แสดงข้อมูลขั้นแรก ส่วน DashBoard ที่ 2 จะแสดงข้อมูลที่อยู่ในระดับที่ต่ำกว่า หรือคือละเอียดกว่า โดยจะใช้วิธีการ Passing Parameter ไปยังอีก DashBoard

1. DashBoard ที่ 1 จะแสดงกราฟเป็น Bar Chart
2. DashBoard ที่ 2 จะ Passing Parameter จาก DashBoard ที่ 1 จะแสดงกราฟเป็น Line Chart

เริ่มต้นให้เราสร้าง DashBoard ที่ 1 และ 2 ให้เรียบร้อย ซึ่ง DashBaord ที่ 2 ยังไม่ต้องสร้างอะไรเลยก็ได้

ตัวอย่าง DashBaord 1

Pentaho CDE Dashboard [Select และ Parameter]

บทความนี้จะพูดถึงการทำตัวเลือก (Select) และเมื่อ Select แล้วเราจะนำค่าที่ Select ส่งไปยัง Query ที่ต้องการใช้ค่าที่ Select คือการส่ง Parameter นั้นเอง

สิ่งที่จะทำ
1. สร้างส่วนของ Select (Select Component)
2. ส่งค่า Parameter ไปใช้ใน Query

30/03/2560

Pentaho CDE DashBoard [การจัดหน้า Dashboard]

การจัดหน้า DashBoard เราจะใช้ Bootstrap เรื่อง Grid System เข้ามาช่วยซึ่งจะช่วยให้ DashBoard ของเรารองรับกับอุปกรณ์ที่มีขนาดต่างกันได้อย่างเหมาะสม

ขั้นตอนแรกเราต้องมารู้จัก Grid System ของ Bootstrap กันก่อน โดย Grid System จะแบ่งออกเป็น 4 ขนาดได้แก่
  1. Extra small devices หรือ Phone (xs)
  2. Small devices หรือ Tablets (sm)
  3. Medium devices หรือ Desktops (md)
  4. Large devices (lg)

Pentaho CDE DashBoard [การใช้งานเบื้องต้น]


Pentaho CDE DashBoard เป็น Plug-in ตัวหนึ่งที่มาพร้อมกับการติดตั้ง Pentaho BI Server (การติดตั้ง) ซึ่งจะแสดงข้อมูลที่ได้จากการ Query ออกมาในรูปแบบของกราฟหรือตาราง ซึ่งรองรับการ Query แบบต่างๆเช่น MDX Query, SQL Query เป็นต้น จะแสดงออกมาผ่าน Web Browser ที่สามารถจัด Design ของหน้า DashBoard ได้เอง

17/03/2560

Nodemcu ESP8266 Connect WiFi

ติดตั้ง Arduino IDE สามารถดาวโหลดได้ ที่นี่



- เมื่อทำการติดตั้ง Arduino IDE เรียบร้อยแล้ว ให้เปิด Arduino IDE ขึ้นมา
- ไปที่ Menu File >> Preferences




- ใส่ URL >> ลงใน Addition Board Manager URLs: ดังนี้
http://arduino.esp8266.com/stable/package_esp8266com_index.json
(สามารถดูข้อมูลเพิ่มเติมหากมีการเปลี่ยนแปลงได้จาก https://github.com/esp8266/Arduino)


- แล้วกด OK
- จากนั้นไปที่ Menu Tools >> Boar:”xxxxxx” >> Board Manager…


- เลือก Type เป็น Contributed ไปที่ ESP8266 และกด Install


- รอจนติดตั้งเสร็จ



- เมื่อติดตั้ง ESP8266 เสร็จเรียบร้อยแล้ว ให้ปิดโปรแกรม Arduino IDE ก่อน แล้วจึงเปิดขึ้นมาใหม่
- เมื่อเปิดโปรแกรม Arduino IDE ขึ้นมาใหม่ ให้ลองไปที่ Menu Tools >> Board:”xxxxxx” จะพบว่า มี Menu สำหรับเลือกใช้งาน ESP8266 กับ Arduino IDE ขึ้นมาให้เลือกใช้งาน


มาถึงขั้นตอนการ connect wifi นะครับ

เขียนโค้ดลงไปในโปรแกรมดังนี้
#include <ESP8266WiFi.h>const char* ssid = "Your WiFi SSID";const char* password = "Your Password"; void setup() { Serial.begin(9600); Serial.println("Starting..."); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(250); Serial.print("."); } Serial.println("WiFi connected"); Serial.println("IP address: "); Serial.println(WiFi.localIP());} void loop() {}
เพียงเท่านี้ก็สามารถทำให้ Nodemcu Connect WiFi ได้แล้ว



 


Arduino วัดอุณหภูมิและความชื้น ด้วยเซนเซอร์ DHT11




รูปภาพ เซนเซอร์ DHT11 



Arduino สามารถใช้งานเป็นอุปกรณ์เซนเซอร์ ความชื้นและอุณหภูมิ สำหรับประยุกต์ใช้กับงานตามต้องการได้ เช่น ระบบควบคุมอุณหภูมิและความชื้นในห้องserver  แล้วเปิดปิดแอร์ตามอุณหภูมิที่ตั้งไว้หรือจะใช้ทำเป็นเซนเซอร์เล็ก ๆ สำหรับมอนิเตอร์อุณหภูมิความชื้นในสถานที่ต่าง ๆ การใช้งานเซนเซอร์อุณหภูมิและความชื้นร่วมกับ Arduino สามารถทำได้โดยง่าย เพราะมีไลบารีมาให้พร้อมใช้งาน เพียงแค่ก็อปไปวางก็สามารถดึงค่าอุณหภูมิและความชื้นออกมาได้แล้ว

ดาวโหลดไลบารี DHT11 ได้ที่นี่ http://www.allarduino.com/download/DHT11.rar

วิธีต่อสายตัวเซนเซอร์ DHT11  เข้ากับArduino


ภาพต่อสายตัวเซนเซอร์ DHT11  เข้ากับArduino


สำหรับการต่อวงจร DHT11 กับ Arduino ต่อตามนี้

สายสีดำ -> Gnd
สายสีแดง -> 5 Vcc
สายสีน้ำเงิน -> 2 (สาย ข้อมูล)

การเขียนโคด Arduino เพื่ออ่านค่าความชื้นและอุณหภูมิจากเซนเซอร์ DHT11 (ในตัวอย่างจะใช้โปรแกรมArduino IDE สามารถดาวโหลดได้ที่นี่)

#include "DHT.h" DHT dht; void setup(){ Serial.begin(9600); Serial.println(); Serial.println("Status\tHumidity (%)\tTemperature (C)\t(F)"); dht.setup(2); // data pin 2} void loop(){ delay(dht.getMinimumSamplingPeriod()); float humidity = dht.getHumidity(); // ดึงค่าความชื้น float temperature = dht.getTemperature(); // ดึงค่าอุณหภูมิ Serial.print(dht.getStatusString()); Serial.print("\t"); Serial.print(humidity, 1); Serial.print("\t\t"); Serial.print(temperature, 1); Serial.print("\t\t"); Serial.println(dht.toFahrenheit(temperature), 1);}
เปิดดูผลลัพธ์ที่หน้าจอ Serial Monitor ก็จะพบว่าเราสามารถดึงค่าอุณหภูมิ ความชื้น
(Tools > Serial Monitor)


Credit : www.arduinoall.com

15/03/2560

การติดตั้ง htop บน CentOS7

htop เป็นคำสั่งที่ผมใช้อยู่เสมอบน Linux ทีใช้งาน
แต่เมื่อมาใช้งาน CentOS แล้วพบว่าไม่สามารถสั่ง Yum install โดยตรงได้ ต้องดำเนินการตามนี้ครับ
yum -y install epel-release
หลงจากนั้นให้ติดตั้งได้ตามปกติครับ
yum -y install htop


เปรียบเทียบผลการทำงานของทั้งสองคำสั่ง

ที่มา
http://elearning.wsldp.com/pcmagazine/centos-install-htop/

13/03/2560

วิธีติดตั้ง Splunk บน CentOS 7

Splunk Enterprise การประมวลผลและวิเคราะห์ข้อมูล Machine Data ด้วยการนำแนวคิดของ Big Data Analytics มาพัฒนาเป็นระบบสำเร็จรูป เพื่อให้ทุกๆ องค์กรสามารถสร้างระบบ Big Data สำหรับจัดเก็บข้อมูลที่มีประโยชน์ต่อธุรกิจหรือระบบ IT และนำไปวิเคราะห์เพื่อประยุกต์ใช้ในงานต่างๆ ได้หลากหลายรูปแบบ ด้วยการตรวจสอบและวิเคราะห์ทุกๆ ข้อมูลที่ถูกจัดเก็บภายในระบบแบบ Real-time ทำให้ Splunk Enterprise มีความสามารถในการค้นหาข้อมูลต่างๆ ในเงื่อนไขตามที่กำหนด, การแสดงผลข้อมูลในรูปแบบของกราฟหรือตารางได้ตามต้องการ และการที่ Splunk Enterprise เปิดกว้างให้สามารถนำข้อมูลทุกชนิดมาจัดเก็บและวิเคราะห์ร่วมกันได้ ทำให้การประยุกต์ใช้ Splunk เป็นไปได้อย่างไร้ขีดจำกัด

Splunk Enterprise สามารถติดตั้งบนระบบปฏิบัติการแบบ 64 บิท บทความนี้จะเขียนเกี่ยวกับการติดตั้ง Splunk Enterprise บนเซิร์ฟเวอร์ CentOS 7 ครับ

1.Download Splunk Enterprise สร้างบัญชีและดาวน์โหลด Splunk จากเว็บไซต์ ที่นี่


กดเลือก Linux ไฟล์ .rpm จากนั้น Upload ไปที่เซริฟเวอร์ที่จะติดตั้ง




2. สร้าง Splunk User และติดตั้งไฟล์ RPM
# groupadd splunk
# chmod 744 splunk_package_name.rpm
# rpm -i splunk_package_name.rpm
default directory ของโปรแกรมจะอยู่ที่ /opt/splunk

3. ติดตั้ง Splunk Enterprise
# su - splunk
$ cd bin/

$ ./splunk start --accept-license

This appears to be your first time running this version of Splunk.

Copying '/opt/splunk/etc/openldap/ldap.conf.default' to '/opt/splunk/etc/openldap/ldap.conf'.
Generating RSA private key, 1024 bit long modulus
.++++++
..................++++++
e is 65537 (0x10001)
writing RSA key

Generating RSA private key, 1024 bit long modulus
................++++++
..++++++
e is 65537 (0x10001)
writing RSA key

Moving '/opt/splunk/share/splunk/search_mrsparkle/modules.new' to '/opt/splunk/share/splunk/search_mrsparkle/modules'.

Splunk> Australian for grep.

Checking prerequisites...
Checking http port [8000]: open
Checking mgmt port [8089]: open
Checking appserver port [127.0.0.1:8065]: open
Checking kvstore port [8191]: open
Checking configuration... Done.
Creating: /opt/splunk/var/lib/splunk
Creating: /opt/splunk/var/run/splunk
Creating: /opt/splunk/var/run/splunk/appserver/i18n
Creating: /opt/splunk/var/run/splunk/appserver/modules/static/css
Creating: /opt/splunk/var/run/splunk/upload
Creating: /opt/splunk/var/spool/splunk
Creating: /opt/splunk/var/spool/dirmoncache
Creating: /opt/splunk/var/lib/splunk/authDb
Creating: /opt/splunk/var/lib/splunk/hashDb
Checking critical directories... Done
Checking indexes...
Validated: _audit _internal _introspection _thefishbucket history main summary
Done
New certs have been generated in '/opt/splunk/etc/auth'.
Checking filesystem compatibility... Done
Checking conf files for problems...
Done
Checking default conf files for edits...
Validating installed files against hashes from '/opt/splunk/splunk-6.4.0-f2c836328108-linux-2.6-x86_64-manifest'
All installed files intact.
Done
All preliminary checks passed.

Starting splunk server daemon (splunkd)...
Generating a 1024 bit RSA private key
.....................++++++
...........................++++++
writing new private key to 'privKeySecure.pem'
-----
Signature ok
subject=/CN=server1.centos7.com/O=SplunkUser
Getting CA Private Key
writing RSA key
Done
[ OK ]

Waiting for web server at http://127.0.0.1:8000 to be available.... Done
If you get stuck, we're here to help.
Look for answers here: http://docs.splunk.com

The Splunk web interface is at http://server1.centos7.com:8000

$ ./splunk enable boot-start

4. ตั้งค่าการใช้งาน Splunk

เข้าใช้งาน Splunk โดยใช้ Username/password ของ Admin คือ admin/changeme หลังจากเข้าสำเร็จ ระบบจะให้เปลี่ยนรหัสผ่านใหม่


 หลังจากเข้าใช้งานผ่าน Username และ Password ใหม่ ระบบก็พร้อมใช้งานแล้วครับ


Ref : docs.splunk.com