Java sockets – system monitoring / server capture process

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...

Monitoring remote Solaris client’s by using Java sockets.

The below configuration shows how to configure a host (Solaris or Linux), to expose local performance states in JSON using Java sockets, the stats are then collected by a remote system to crunch (graph/chart) the data.

The full capture pipeline process is outline below.
Note: If losing client stat data is a concern, Flume or Logstah combined with Kafka can be used, for more details how to read here and here.

  • Capture the local stats about every second to a local SQLite DataBase
  • On the client, expose the latest stat with Json format
  • Connect to the client (about) every second to capture the latest stats
  • Append the latest stats to the local DB
  • By user request graph or chart the stored data (can be in real time if needed)

Note: This is the first part, how to capture the stats locally. Click here on how to publish these stats.

Creating a Java socket for local capture.

First lets create the java capture process.
This java program will capture local system resources usage and store it in a local SQLite3 DB.

The Java capture process program
Note: The Java capture program uses Sigar a C compiled program to capture some of the system resources.
The CaptureSysStats.java (main)

The program will get the resource usage i.e CPU, Mem, etc
The GetResStats.java

Now lets capture all the stats in SQLite local data for latter retrieval

Note: Due to Solaris limitation’s I am not using all resources like Network, disk. but this can easily be extended on other OS’s.

For how to publish the captured stats, please click here – Java sockets – system monitoring / server publisher process.

Leave a Reply

avatar
  Subscribe  
Notify of