DevTech101

DevTech101
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5.00 out of 5)
Loading...

How to Capturing / create your own custom analytics

Note: There is an updated process for Solaris 11.4+, please check out part 5 – Enhanced method on how to capture analytics in Solaris 11.4+ Note: The full code is available in a GitHub repository. to play with the code, feel free to just clone the Solaris Analytics Publisher repository.
  • part 1 on how to configure analytics
  • Please check out part 2 on how to configure the client capture stat process
  • Please check out part 3 on how to publish the client captured stats.
  • Please check out part 4 Configuring / Accessing the Web Dashboard / UI.
  • Please check out part 5 Capturing Solaris 11.4 (12) Analytics By Using Remote Administration Daemon (RAD).

First, Make sure the services are online

svcs svc:/system/webui/server:default svc:/system/sstore:default

# Note: Also make sure the below service is online for stats to work properly. 
svcs svc:/system/sysstat:default

Creating Your own monitoring stats

In the steps below, we first create a stats store place holder for the data we are going to capture. Step one:, We need to create a class and stat file. Go to /usr/lib/sstore/metadata/json/site

Create a class file

Besides the regular system fields, I added a some data base fields. Like the two fields below.
//:stat.db1.qry-time
//:stat.db1.ses-count
Note: The file below uses servers as the dynamic namespace.
cat /usr/lib/sstore/metadata/json/site/class.db1.json
{
    "$schema": "//:class",
    "description": "Remote Server Stats",
    "id": "app/company/servers",
    "namespaces": [
        {
            "name-type": "string",
            "resource-name": "server"
        }
    ],
    "stability": "stable",
    "stat-names": [
        "//:stat.date_time",
        "//:stat.cpu.usage-sys",
        "//:stat.cpu.usage-usr",
        "//:stat.cpu.usage-total",
        "//:stat.memory-used",
        "//:stat.memory-total",
        "//:stat.swap-used",
        "//:stat.swap-total",
        "//:stat.net.in-megabytes",
        "//:stat.net.out-megabytes",
        "//:stat.disk.read-megabytes-0B",
        "//:stat.disk.write-megabytes-0B",
        "//:stat.disk.read-ops-0B",
        "//:stat.disk.write-ops-0B",
        "//:stat.disk.read_wait-time-0B",
        "//:stat.disk.write_wait-time-0B",
        "//:stat.disk.read-megabytes-0C",
        "//:stat.disk.write-megabytes-0C",
        "//:stat.disk.read-ops-0C",
        "//:stat.disk.write-ops-0C",
        "//:stat.disk.read_wait-time-0C",
        "//:stat.disk.write_wait-time-0C",
        "//:stat.db1.qry-time",
        "//:stat.db1.ses-count",
        "//:stat.db1.date_gen"
    ]
}

Create a stat file

Next, we need to create the stats file, the stats file sets the capture schema for every field we capture.
cat /usr/lib/sstore/metadata/json/site/stat.db1.json
[
    {
       "$schema": "//:stat",
       "description": "date_time",
       "id": "//:class.app/company/servers//:stat.date_time",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "cpu usage sys",
       "id": "//:class.app/company/servers//:stat.cpu.usage-sys",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "cpu usage usr",
       "id": "//:class.app/company/servers//:stat.cpu.usage-usr",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "cpu total",
       "id": "//:class.app/company/servers//:stat.cpu.usage-total",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "memory total",
       "id": "//:class.app/company/servers//:stat.memory-total",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "memory used",
       "id": "//:class.app/company/servers//:stat.memory-used",
       "stability": "stable",
       "max-rate": "//:stat.memory-total",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "swap total",
       "id": "//:class.app/company/servers//:stat.swap-total",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "swap used",
       "id": "//:class.app/company/servers//:stat.swap-used",
       "stability": "stable",
       "max-rate": "//::stat.swap-total",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "net in megabytes",
       "id": "//:class.app/company/servers//:stat.net.in-megabytes",
       "stability": "stable",
       "type": "counter",
       "units": "kilobytes"
    },
    {
       "$schema": "//:stat",
       "description": "network out megabytes",
       "id": "//:class.app/company/servers//:stat.net.out-megabytes",
       "stability": "stable",
       "type": "counter",
       "units": "kilobytes"
    },
    {
       "$schema": "//:stat",
       "description": "disk read-megabytes (0B)",
       "id": "//:class.app/company/servers//:stat.disk.read-megabytes-0B",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk write-megabytes (0B)",
       "id": "//:class.app/company/servers//:stat.disk.write-megabytes-0B",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk read-ops (0B)",
       "id": "//:class.app/company/servers//:stat.disk.read-ops-0B",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk write-ops (0B)",
       "id": "//:class.app/company/servers//:stat.disk.write-ops-0B",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk read wait-time (0B)",
       "id": "//:class.app/company/servers//:stat.disk.read_wait-time-0B",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk write wait-time (0B)",
       "id": "//:class.app/company/servers//:stat.disk.write_wait-time-0B",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },

    {
       "$schema": "//:stat",
       "description": "disk read-megabytes (0C)",
       "id": "//:class.app/company/servers//:stat.disk.read-megabytes-0C",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk write-megabytes (0C)",
       "id": "//:class.app/company/servers//:stat.disk.write-megabytes-0C",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk read-ops (0C)",
       "id": "//:class.app/company/servers//:stat.disk.read-ops-0C",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk write-ops (0C)",
       "id": "//:class.app/company/servers//:stat.disk.write-ops-0C",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk read wait-time (0C)",
       "id": "//:class.app/company/servers//:stat.disk.read_wait-time-0C",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "disk write wait-time (0C)",
       "id": "//:class.app/company/servers//:stat.disk.write_wait-time-0C",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "db1 query-time",
       "id": "//:class.app/company/servers//:stat.db1.qry-time",
       "stability": "stable",
       "max-rate": "150",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "db1 session-count",
       "id": "//:class.app/company/servers//:stat.db1.ses-count",
       "stability": "stable",
       "max-rate": "3500",
       "type": "counter",
       "units": "calls"
    },
    {
       "$schema": "//:stat",
       "description": "db1 date generate",
       "id": "//:class.app/company/servers//:stat.db1.date_gen",
       "stability": "stable",
       "type": "counter",
       "units": "calls"
    }
]
Tip: Its a good idea to make sure the json is clean with no errors.

Next we need to restart the services

In order for the Solaris Stats Store to know about the new fields an sstore is required.
svcadm restart sstore

After adding some values, verify if it works

Lets test if the new fields work as expected. The below will output any values update to our newly created schema fields.
sstore capture //:class.app/company/servers//:res.server/*//:stat.db1.qry-time
TIME                VALUE IDENTIFIER
2016-08-31T16:58:24 23 //:class.app/company/servers//:res.server/*//:stat.db1.qry-time
...
Next will explorer how to populate the Stats Store (analytics) with data, Click here to go to part 2. You might also like – Articles related to Oracle Solaris 11.4/Solaris 12. Like what you’re reading? please provide feedback, any feedback is appreciated.
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
%d bloggers like this: