config updates (#1800)
* cleanup * update create plugin config and query help fix * query types file * Update docker-compose.yml Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com> * addressed review comments --------- Co-authored-by: Zoltán Bedi <zoltan.bedi@gmail.com>
This commit is contained in:
28
src/datasource/types/config.ts
Normal file
28
src/datasource/types/config.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { DataSourceJsonData } from '@grafana/data';
|
||||
|
||||
export enum ZabbixAuthType {
|
||||
UserLogin = 'userLogin',
|
||||
Token = 'token',
|
||||
}
|
||||
|
||||
export type ZabbixDSOptions = {
|
||||
authType?: ZabbixAuthType;
|
||||
username: string;
|
||||
password?: string;
|
||||
trends: boolean;
|
||||
trendsFrom: string;
|
||||
trendsRange: string;
|
||||
cacheTTL: string;
|
||||
timeout?: number;
|
||||
dbConnectionEnable: boolean;
|
||||
dbConnectionDatasourceId?: number;
|
||||
dbConnectionDatasourceName?: string;
|
||||
dbConnectionRetentionPolicy?: string;
|
||||
disableReadOnlyUsersAck: boolean;
|
||||
disableDataAlignment: boolean;
|
||||
enableSecureSocksProxy?: boolean;
|
||||
} & DataSourceJsonData;
|
||||
|
||||
type ZabbixSecureJSONDataKeys = 'password' | 'apiToken';
|
||||
|
||||
export type ZabbixSecureJSONData = Partial<Record<ZabbixSecureJSONDataKeys, string>>;
|
||||
110
src/datasource/types/query.ts
Normal file
110
src/datasource/types/query.ts
Normal file
@@ -0,0 +1,110 @@
|
||||
import { DataQuery } from '@grafana/schema';
|
||||
import * as c from './../constants';
|
||||
|
||||
export type QueryType =
|
||||
| typeof c.MODE_METRICS
|
||||
| typeof c.MODE_ITSERVICE
|
||||
| typeof c.MODE_TEXT
|
||||
| typeof c.MODE_ITEMID
|
||||
| typeof c.MODE_TRIGGERS
|
||||
| typeof c.MODE_PROBLEMS
|
||||
| typeof c.MODE_MACROS;
|
||||
|
||||
type BaseQuery = { queryType: QueryType; datasourceId: number } & DataQuery;
|
||||
|
||||
export type ZabbixMetricsQuery = {
|
||||
schema: number;
|
||||
group: { filter: string; name?: string };
|
||||
host: { filter: string; name?: string };
|
||||
application: { filter: string; name?: string };
|
||||
itemTag: { filter: string; name?: string };
|
||||
item: { filter: string; name?: string };
|
||||
macro: { filter: string; macro?: string };
|
||||
textFilter: string;
|
||||
mode: number;
|
||||
itemids: string;
|
||||
useCaptureGroups: boolean;
|
||||
proxy?: { filter: string };
|
||||
trigger?: { filter: string };
|
||||
itServiceFilter?: string;
|
||||
slaFilter?: string;
|
||||
slaProperty?: any;
|
||||
slaInterval?: string;
|
||||
tags?: { filter: string };
|
||||
triggers?: { minSeverity: number; acknowledged: number; count: boolean };
|
||||
countTriggersBy?: 'problems' | 'items' | '';
|
||||
evaltype?: ZabbixTagEvalType;
|
||||
functions?: MetricFunc[];
|
||||
options?: ZabbixQueryOptions;
|
||||
// Problems
|
||||
showProblems?: ShowProblemTypes;
|
||||
// Deprecated
|
||||
hostFilter?: string;
|
||||
itemFilter?: string;
|
||||
macroFilter?: string;
|
||||
} & BaseQuery;
|
||||
|
||||
export interface ZabbixQueryOptions {
|
||||
showDisabledItems?: boolean;
|
||||
skipEmptyValues?: boolean;
|
||||
disableDataAlignment?: boolean;
|
||||
useZabbixValueMapping?: boolean;
|
||||
useTrends?: 'default' | 'true' | 'false';
|
||||
// Problems options
|
||||
minSeverity?: number;
|
||||
sortProblems?: string;
|
||||
acknowledged?: number;
|
||||
hostsInMaintenance?: boolean;
|
||||
hostProxy?: boolean;
|
||||
limit?: number;
|
||||
useTimeRange?: boolean;
|
||||
severities?: number[];
|
||||
count?: boolean;
|
||||
|
||||
// Annotations
|
||||
showOkEvents?: boolean;
|
||||
hideAcknowledged?: boolean;
|
||||
showHostname?: boolean;
|
||||
}
|
||||
|
||||
export interface MetricFunc {
|
||||
text: string;
|
||||
params: Array<string | number>;
|
||||
def: FuncDef;
|
||||
added?: boolean;
|
||||
}
|
||||
|
||||
export interface FuncDef {
|
||||
name: string;
|
||||
params: ParamDef[];
|
||||
defaultParams: Array<string | number>;
|
||||
category?: string;
|
||||
shortName?: any;
|
||||
fake?: boolean;
|
||||
version?: string;
|
||||
description?: string;
|
||||
/**
|
||||
* True if the function was not found on the list of available function descriptions.
|
||||
*/
|
||||
unknown?: boolean;
|
||||
}
|
||||
|
||||
export type ParamDef = {
|
||||
name: string;
|
||||
type: string;
|
||||
options?: Array<string | number>;
|
||||
multiple?: boolean;
|
||||
optional?: boolean;
|
||||
version?: string;
|
||||
};
|
||||
|
||||
export enum ShowProblemTypes {
|
||||
Problems = 'problems',
|
||||
Recent = 'recent',
|
||||
History = 'history',
|
||||
}
|
||||
|
||||
export enum ZabbixTagEvalType {
|
||||
AndOr = '0',
|
||||
Or = '2',
|
||||
}
|
||||
Reference in New Issue
Block a user