Skip to content

Commit

Permalink
Fix handling value mappings for ItemID mode, fix #1148
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderzobnin committed Jan 28, 2021
1 parent cee10f5 commit 884f4d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/datasource-zabbix/timeseries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function downsample(datapoints, time_to, ms_interval, func) {
* Detects interval between data points and aligns time series. If there's no value in the interval, puts null as a value.
*/
export function align(datapoints: TimeSeriesPoints, interval?: number): TimeSeriesPoints {
if (interval) {
if (!interval) {
interval = detectSeriesInterval(datapoints);
}

Expand Down
2 changes: 1 addition & 1 deletion src/datasource-zabbix/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ export function convertZabbixUnit(zabbixUnit: string): string {

export function getValueMapping(item, valueMappings: any[]): ValueMapping[] | null {
const { valuemapid } = item;
const mapping = valueMappings.find(m => m.valuemapid === valuemapid);
const mapping = valueMappings?.find(m => m.valuemapid === valuemapid);
if (!mapping) {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,15 @@ export class ZabbixAPIConnector {
const params = {
itemids: itemids,
output: [
'name', 'key_',
'name',
'key_',
'value_type',
'hostid',
'status',
'state'
'state',
'units',
'valuemapid',
'delay'
],
webitems: true,
selectHosts: ['hostid', 'name']
Expand Down

0 comments on commit 884f4d0

Please sign in to comment.