Monitor Application เพียงอย่างเดียวไม่พอ Get Full Picture ของ Systems บ่อยครั้ง Services Running in Satellite Apps (หรือ Supporting Apps) มี Acute Impact ต่อ Day-to-day Operations Database Servers เป็น Well-known Examples Backup Scripts และ Background Jobs อื่นๆ สามารถ Slow Systems และมัก Overlooked
AppSignal APM สำหรับ Node.js, Ruby APM และ Elixir APM Auto-instrument App เอง แต AppSignal ไม่ Watch Satellite Processes by Default เพื่อ Extend Monitoring Everywhere และ Have All Data in Single App คุณ Install AppSignal's Standalone Agent
AppSignal's Standalone Agent
Standalone Agent Based on Same Software Instrument Ruby, Elixir, หรือ JavaScript Applications Software นี้ Run in Standalone Mode ได้
Standalone Agent ใช้ Monitor:
- Infrastructure: Machines Part of System แต่ไม่ Run Application Code
- Background Jobs: เช่น Intensive Cron Jobs หรือ Long-running Data-processing Scripts ถ้า Background Jobs เขียนใน Supported Languages (Ruby, Elixir, Node.js) ใช้ Standard Integration
- More Languages: Programs Written in Languages Other Than Supported Out of the Box
เช่น Standalone Agent Track Machine Learning Model Python, Instrument Backup Scripts, Monitor Kafka Brokers, Collect Host Metrics Web Farms View All This on AppSignal Complement Metrics Main Applications
How It Works
Agent Shipped as deb/rpm Package No Language Dependencies Run Any Debian/Ubuntu หรือ Red Hat-based Systems Detailed Installation Instructions Check Agent Documentation
Once Installed Agent Configured in Minutes Runs Forever as Daemon Silently Monitoring Infrastructure What's More Agent Includes StatsD Server Relay Custom Data You Log into AppSignal Dashboard
What Is StatsD?
StatsD เป็น Standard Collect และ Aggregate Arbitrary Data Focus Log Metric และ Performance Information ใช้ Lightweight Text Protocol over UDP Connections Small Footprint Machine
StatsD Message เหมือนนี้:
Where KEY Arbitrary String VALUE Number Type Value Defines How Number Processed
เรา Support 3 Metric Types:
- c: Counter Increment Each Time Called เช่น
active_users:1|cAdd 1 toactive_usersCounter - g: Gauge Takes Numeric Value Maintain Until Updated Useful Record Values Change Up/Down Over Time เช่น Throughput, Active Users, Pending Tasks in Queue
- t: Stores Timing Values Ideal Track Durations AppSignal Calculate Means, Count, Percentiles All Logged Timings
Other Unsupported Metric Types Silently Ignored
Sending Data to StatsD
Standalone Agent Listen UDP Packets Port 8125 ส่ง StatsD-formatted Strings Command Line Netcat:
ใช้ UDP ไม่ต้อง Wait Response
Socat Works Too:
ทำให้ Easy Instrument Any Batch/Cron Jobs เช่น Lines นี้ Gauge Log Data Backup Job Generated:
Not Limited to Integers StatsD Works Floating-point Numbers:
Add Tags to Metrics StatsD Server Support Optional Tags End of Message:
Apply Several Tags Same Message Assign Values Filtering Later:
เราจะเรียนรู้ View Data in AppSignal ในไม่ช้า
Instrumenting Languages
StatsD Server Compatible Any Language Send UDP Packets มาดู Examples
Python Popular Data Mining และ Machine Learning Add Instrumentation Python Apps Built-in socket Library:
Similar Results Java java.net Library:
PHP Another Popular Language Send UDP Packets socket_sendto:
StatsD Clients
Thus Far Used Built-in Networking Capabilities Every Language But More Many Languages/Products Include Third-party StatsD Clients/Addons Any StatsD-compliant Client Should Work At Least Supported Data Types Find Clients List at StatsD Project Wiki
Viewing Host Data in AppSignal
Host Metrics Dashboard Shows Machine's Resource Utilization:

AppSignal Add Entry Every Machine Running Standalone Agent

Dashboard Shows Load และ CPU Averages Disk, Network, Memory, Swap Usage:


Creating Dashboards
AppSignal ไม่ Auto-generate Dashboards StatsD Values You Sent — Need Create Custom Dashboards
First Click Add dashboard Under Dashboard Menu:

Give Name to Dashboard:

Click Add graph Shows Graph Builder:

Give Name Graph Click Add metric:

Pick Metric Interested From Menu:

Optionally Use Tags Filtering:

Next Click Back to overview Try Different Graph Types และ Value Units Find Best Suits Data Represent
Timing Data Looks Better Area Graphs Because Mean และ Percentiles Shown Clearly

Line Graphs Work Great Counters และ Gauges

Once Happy Click Create graph

Note: Add Dashboard Other Automatically Instrumented/Measured Metrics หาก AppSignal Setup as APM Node.js, Ruby (on Rails) APM หรือ Elixir APM
Wrapping Up
เราเรียนรู้ใช้ AppSignal Standalone Server Watch Machines และ Satellite Code Built-in StatsD Server Record Arbitrary Performance Data Instrument Any Process
Check Links Learn More Standalone Agent:
- StatsD Reference
- How to Send Custom Metrics
- Creating Dashboards in AppSignal
- Identifying and Resolving a Kafka Issue the Standalone Agent
Tomas Fernandez
ผู้เขียน אורח Tomas ใช้ 10 ปี IBM ทำ Everything — Development, Service Delivery, Database Admin, Cloud Engineering ตอนนี้ Independent Consultant และ Technical Writer
บทความทั้งหมดโดย Tomas Fernandez