Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev 1.1.1 yongsik #325

Merged
merged 5 commits into from
Nov 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
200 changes: 200 additions & 0 deletions backend/canned/cloudwatch_aws_application_elb.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
{
"id": "8beff1bf-5e86-4196-ae1f-4c369b8bd879",
"measurement": "cloudwatch_aws_application_elb",
"app": "cloudwatch_elb",
"autoflow": true,
"cells": [
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "a74a23a5-0581-4602-9058-03aa9e8163cd",
"name": "Target Response Time (Milliseconds)",
"queries": [
{
"query": "SELECT mean(\"target_response_time_average\") AS \"mean_target_response_time_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "29f50f58-9885-4412-9720-52d6d93f3f48",
"name": "Requests (Count)",
"queries": [
{
"query": "SELECT mean(\"request_count_average\") AS \"mean_request_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "153d5847-4edf-4c48-b95a-b4005c942dc5",
"name": "Rule Evaluations (Count)",
"queries": [
{
"query": "SELECT mean(\"rule_evaluations_average\") AS \"mean_rule_evaluations_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "de45086c-c634-45c5-a3b6-96c2724ca379",
"name": "HTTP 4XXs (Count)",
"queries": [
{
"query": "SELECT mean(\"http_code_target_4xx_count_average\") AS \"mean_http_code_target_4xx_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "12dbc7cc-04e7-4ec9-b0c9-e00032cac594",
"name": "ELB 4XXs (Count)",
"queries": [
{
"query": "SELECT mean(\"http_code_elb_4xx_count_average\") AS \"mean_http_code_elb_4xx_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "ad152565-f9dc-4171-bb42-f4f3fe732a24",
"name": "Client TLS Negotiation Errors (Count)",
"queries": [
{
"query": "SELECT mean(\"client_tls_negotiation_error_count_average\") AS \"mean_client_tls_negotiation_error_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "a2163fad-fc67-4de9-bc60-b7b4004843f7",
"name": "HTTP 3XXs (Count)",
"queries": [
{
"query": "SELECT mean(\"http_code_target_3xx_count_average\") AS \"mean_http_code_target_3xx_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "32de912e-984d-4663-977e-f1ee2ff84e34",
"name": "HTTP 2XXs (Count)",
"queries": [
{
"query": "SELECT mean(\"http_code_target_2xx_count_average\") AS \"mean_http_code_target_2xx_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "f2eb7077-41f6-4e1c-9bda-1f50a568ef4a",
"name": "Active Connection Count (Count)",
"queries": [
{
"query": "SELECT mean(\"active_connection_count_average\") AS \"mean_active_connection_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "8ae578e3-ac1d-4980-b6b7-66ed979e73de",
"name": "New Connection Count (Count)",
"queries": [
{
"query": "SELECT mean(\"new_connection_count_average\") AS \"mean_new_connection_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "22ad1e99-54e8-4952-839a-ba0e6baf62f2",
"name": "Processed Bytes (Bytes)",
"queries": [
{
"query": "SELECT mean(\"processed_bytes_average\") AS \"mean_processed_bytes_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
},
{
"x": 0,
"y": 0,
"w": 4,
"h": 4,
"i": "8e8813ef-2f4c-4e99-9b8f-6e8cd3a8b2d6",
"name": "HTTP redirect count (Count)",
"queries": [
{
"query": "SELECT mean(\"http_redirect_count_average\") AS \"mean_http_redirect_count_average\" FROM \":db:\".\":rp:\".\"cloudwatch_aws_application_elb\"",
"label": "",
"groupbys": [],
"wheres": []
}
]
}
]
}
1 change: 1 addition & 0 deletions frontend/assets/images/Elastic-Load-Balancing-ELB.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 10 additions & 9 deletions frontend/src/agent_admin/components/AgentConfigurationTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -294,15 +294,16 @@ class AgentConfigurationTable extends PureComponent<Props, State> {
{sortedHosts.length > 0 ? (
<FancyScrollbar
children={sortedHosts.map(
(m: Minion, i: number): JSX.Element => (
<AgentConfigurationTableRow
key={i}
minions={m}
onClickTableRow={onClickTableRow}
onClickAction={onClickAction}
focusedHost={focusedHost}
/>
)
(m: Minion, i: number): JSX.Element =>
m.os && m.os.toLocaleLowerCase() !== 'windows' ? (
<AgentConfigurationTableRow
key={i}
minions={m}
onClickTableRow={onClickTableRow}
onClickAction={onClickAction}
focusedHost={focusedHost}
/>
) : null
)}
className="hosts-table--tbody"
/>
Expand Down
67 changes: 56 additions & 11 deletions frontend/src/hosts/apis/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,6 @@ const EmptyHost: Host = {
deltaUptime: -1,
apps: [],
}

const EmptyCSPHosts: Host = {
name: '',
cpu: null,
load: null,
memory: null,
disk: null,
deltaUptime: -1,
apps: [],
}

interface Series {
name: string
columns: string[]
Expand Down Expand Up @@ -290,6 +279,41 @@ export const getAppsForHost = async (
return appsForHost
}

export const getAppsForEtc = async (
proxyLink: string,
host: string,
appLayouts: Layout[],
telegrafDB: string
) => {
const measurements = appLayouts.map(m => `^${m.measurement}$`).join('|')
const measurementsToApps = _.zipObject(
appLayouts.map(m => m.measurement),
appLayouts.map(({app}) => app)
)

const {data} = await proxy({
source: proxyLink,
query: `show series from /${measurements}/ where load_balancer = '${host}' or "host" = '${host}'`,
db: telegrafDB,
})

const appsForEtc: AppsForHost = {apps: [], tags: {host: null}}

const allSeries = getDeep<string[][]>(data, 'results.0.series.0.values', [])

allSeries.forEach(series => {
const seriesObj = parseSeries(series[0])
const measurement = seriesObj.measurement

appsForEtc.apps = _.uniq(
appsForEtc.apps.concat(measurementsToApps[measurement])
)
_.assign(appsForEtc.tags, seriesObj.tags)
})

return appsForEtc
}

export const getAppsForInstance = async (
proxyLink: string,
instance: object,
Expand Down Expand Up @@ -506,6 +530,27 @@ export const getMeasurementsForInstance = async (
return measurements
}

export const getMeasurementsForEtc = async (
source: Source,
host: string
): Promise<string[]> => {
const {data} = await proxy({
source: source.links.proxy,
query: `SHOW MEASUREMENTS WHERE "load_balancer" = '${host}' or "host" = '${host}'`,
db: source.telegraf,
})

if (isEmpty(data) || hasError(data)) {
return []
}

const values = getDeep<string[][]>(data, 'results.[0].series.[0].values', [])
const measurements = values.map(m => {
return m[0]
})
return measurements
}

const parseSeries = (seriesString: string): SeriesObj => {
const ident = /\w+/
const tag = /,?([^=]+)=([^,]+)/
Expand Down
11 changes: 7 additions & 4 deletions frontend/src/hosts/components/CspHostsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface Instance {
export interface Props {
cloudHosts: CloudHost[]
providerRegions: string[]
hostsPageStatus: RemoteDataState
awsPageStatus: RemoteDataState
source: Source
focusedInstance: Instance
onClickTableRow: HostsPage['handleClickCspTableRow']
Expand Down Expand Up @@ -177,18 +177,21 @@ class CspHostsTable extends PureComponent<Props, State> {
}

private get CloudTableContents(): JSX.Element {
const {cloudHosts, hostsPageStatus} = this.props
const {cloudHosts, awsPageStatus} = this.props
const {sortKey, sortDirection, searchTerm} = this.state
const sortedHosts = this.getSortedHosts(
cloudHosts,
searchTerm,
sortKey,
sortDirection
)
if (hostsPageStatus === RemoteDataState.Loading) {
if (
awsPageStatus === RemoteDataState.Loading ||
awsPageStatus === RemoteDataState.NotStarted
) {
return this.LoadingState
}
if (hostsPageStatus === RemoteDataState.Error) {
if (awsPageStatus === RemoteDataState.Error) {
return this.ErrorState
}
if (cloudHosts.length === 0) {
Expand Down
5 changes: 4 additions & 1 deletion frontend/src/hosts/components/HostsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,10 @@ class HostsTable extends PureComponent<Props, State> {
sortKey,
sortDirection
)
if (hostsPageStatus === RemoteDataState.Loading) {
if (
hostsPageStatus === RemoteDataState.Loading ||
hostsPageStatus === RemoteDataState.NotStarted
) {
return this.LoadingState
}
if (hostsPageStatus === RemoteDataState.Error) {
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/hosts/components/InventoryTreemenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,8 @@ class InventoryTreemenu extends React.Component<TreeMenuProps, TreeMenuState> {
data_navi: `${el.getAttribute(
'data-parent'
)}.nodes.${el.getAttribute('data-label')}.nodes.${instanseId}`,
status: true,
detected: true,
}
return node
})
Expand Down Expand Up @@ -309,6 +311,8 @@ class InventoryTreemenu extends React.Component<TreeMenuProps, TreeMenuState> {
name: value,
type: 'Server',
data_navi: dataNavi,
status: true,
detected: true,
}

let ds = mxUtils.makeDraggable(
Expand Down
Loading