| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | //go:build linux || freebsd || openbsd || netbsd || dragonfly |
| 4 | |
| 5 | package litespeed |
| 6 | |
| 7 | import "github.com/netdata/netdata/go/plugins/plugin/framework/collectorapi" |
| 8 | |
| 9 | const ( |
| 10 | prioRequests = collectorapi.Priority + iota |
| 11 | prioRequestsProcessing |
| 12 | prioNetThroughputHttp |
| 13 | prioNetThroughputHttps |
| 14 | prioConnectionsHttp |
| 15 | prioConnectionsHttps |
| 16 | prioPublicCacheHits |
| 17 | prioPrivateCacheHits |
| 18 | prioStaticHits |
| 19 | ) |
| 20 | |
| 21 | var charts = collectorapi.Charts{ |
| 22 | requestsChart.Copy(), |
| 23 | requestsProcessingChart.Copy(), |
| 24 | |
| 25 | netThroughputHttpChart.Copy(), |
| 26 | netThroughputHttpsChart.Copy(), |
| 27 | |
| 28 | connectionsHttpChart.Copy(), |
| 29 | connectionsHttpsChart.Copy(), |
| 30 | |
| 31 | publicCacheHitsChart.Copy(), |
| 32 | privateCacheHitsChart.Copy(), |
| 33 | staticCacheHitsChart.Copy(), |
| 34 | } |
| 35 | |
| 36 | var ( |
| 37 | requestsChart = collectorapi.Chart{ |
| 38 | ID: "requests", |
| 39 | Title: "Requests", |
| 40 | Units: "requests/s", |
| 41 | Fam: "requests", |
| 42 | Ctx: "litespeed.requests", |
| 43 | Priority: prioRequests, |
| 44 | Dims: collectorapi.Dims{ |
| 45 | {ID: "req_per_sec", Name: "requests", Div: precision}, |
| 46 | }, |
| 47 | } |
| 48 | requestsProcessingChart = collectorapi.Chart{ |
| 49 | ID: "requests_processing", |
| 50 | Title: "Processing requests", |
| 51 | Units: "requests", |
| 52 | Fam: "requests", |
| 53 | Ctx: "litespeed.requests_processing", |
| 54 | Priority: prioRequestsProcessing, |
| 55 | Dims: collectorapi.Dims{ |
| 56 | {ID: "req_processing", Name: "processing"}, |
| 57 | }, |
| 58 | } |
| 59 | ) |
| 60 | |
| 61 | var ( |
| 62 | netThroughputHttpChart = collectorapi.Chart{ |
| 63 | ID: "net_throughput_http", |
| 64 | Title: "HTTP throughput", |
| 65 | Units: "kilobits/s", |
| 66 | Fam: "throughput", |
| 67 | Ctx: "litespeed.net_throughput", |
| 68 | Type: collectorapi.Area, |
| 69 | Priority: prioNetThroughputHttp, |
| 70 | Dims: collectorapi.Dims{ |
| 71 | {ID: "bps_in", Name: "in"}, |
| 72 | {ID: "bps_out", Name: "out", Div: -1}, |
| 73 | }, |
| 74 | } |
| 75 | netThroughputHttpsChart = collectorapi.Chart{ |
| 76 | ID: "net_throughput_https", |
| 77 | Title: "HTTPs throughput", |
| 78 | Units: "kilobits/s", |
| 79 | Fam: "throughput", |
| 80 | Ctx: "litespeed.net_ssl_throughput", |
| 81 | Type: collectorapi.Area, |
| 82 | Priority: prioNetThroughputHttps, |
| 83 | Dims: collectorapi.Dims{ |
| 84 | {ID: "ssl_bps_in", Name: "in"}, |
| 85 | {ID: "ssl_bps_out", Name: "out", Div: -1}, |
| 86 | }, |
| 87 | } |
| 88 | ) |
| 89 | |
| 90 | var ( |
| 91 | connectionsHttpChart = collectorapi.Chart{ |
| 92 | ID: "connections_http", |
| 93 | Title: "HTTP connections", |
| 94 | Units: "connections", |
| 95 | Fam: "connections", |
| 96 | Ctx: "litespeed.connections", |
| 97 | Type: collectorapi.Stacked, |
| 98 | Priority: prioConnectionsHttp, |
| 99 | Dims: collectorapi.Dims{ |
| 100 | {ID: "availconn", Name: "free"}, |
| 101 | {ID: "plainconn", Name: "used"}, |
| 102 | }, |
| 103 | } |
| 104 | connectionsHttpsChart = collectorapi.Chart{ |
| 105 | ID: "connections_https", |
| 106 | Title: "HTTPs connections", |
| 107 | Units: "connections", |
| 108 | Fam: "connections", |
| 109 | Ctx: "litespeed.ssl_connections", |
| 110 | Type: collectorapi.Stacked, |
| 111 | Priority: prioConnectionsHttps, |
| 112 | Dims: collectorapi.Dims{ |
| 113 | {ID: "availssl", Name: "free"}, |
| 114 | {ID: "sslconn", Name: "used"}, |
| 115 | }, |
| 116 | } |
| 117 | ) |
| 118 | |
| 119 | var ( |
| 120 | publicCacheHitsChart = collectorapi.Chart{ |
| 121 | ID: "pub_cache_hits", |
| 122 | Title: "Public cache hits", |
| 123 | Units: "hits/s", |
| 124 | Fam: "cache", |
| 125 | Ctx: "litespeed.public_cache", |
| 126 | Priority: prioPublicCacheHits, |
| 127 | Dims: collectorapi.Dims{ |
| 128 | {ID: "pub_cache_hits_per_sec", Name: "hits", Div: precision}, |
| 129 | }, |
| 130 | } |
| 131 | privateCacheHitsChart = collectorapi.Chart{ |
| 132 | ID: "private_cache_hits", |
| 133 | Title: "Private cache hits", |
| 134 | Units: "hits/s", |
| 135 | Fam: "cache", |
| 136 | Ctx: "litespeed.private_cache", |
| 137 | Priority: prioPrivateCacheHits, |
| 138 | Dims: collectorapi.Dims{ |
| 139 | {ID: "private_cache_hits_per_sec", Name: "hits", Div: precision}, |
| 140 | }, |
| 141 | } |
| 142 | |
| 143 | staticCacheHitsChart = collectorapi.Chart{ |
| 144 | ID: "static_hits", |
| 145 | Title: "Static hits", |
| 146 | Units: "hits/s", |
| 147 | Fam: "static", |
| 148 | Ctx: "litespeed.static", |
| 149 | Priority: prioStaticHits, |
| 150 | Dims: collectorapi.Dims{ |
| 151 | {ID: "static_hits_per_sec", Name: "hits", Div: precision}, |
| 152 | }, |
| 153 | } |
| 154 | ) |