File

src/app/shared/api/prometheus.service.ts

Index

Properties
Methods

Constructor

constructor(http: HttpClient, settingsService: SettingsService)
Parameters :
Name Type Optional
http HttpClient No
settingsService SettingsService No

Methods

getNotificationSince
getNotificationSince(notification)
Parameters :
Name Optional
notification No
ifAlertmanagerConfigured
ifAlertmanagerConfigured(fn)
Parameters :
Name Optional
fn No
Returns : void
list
list(params: object)
Parameters :
Name Type Optional Default value
params object No {}

Properties

Private baseURL
Type : string
Default value : 'api/prometheus'
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';

import { Observable } from 'rxjs';

import { PrometheusAlert, PrometheusNotification } from '../models/prometheus-alerts';
import { ApiModule } from './api.module';
import { SettingsService } from './settings.service';

@Injectable({
  providedIn: ApiModule
})
export class PrometheusService {
  private baseURL = 'api/prometheus';

  constructor(private http: HttpClient, private settingsService: SettingsService) {}

  ifAlertmanagerConfigured(fn): void {
    this.settingsService.ifSettingConfigured('api/settings/alertmanager-api-host', fn);
  }

  list(params = {}): Observable<PrometheusAlert[]> {
    return this.http.get<PrometheusAlert[]>(this.baseURL, { params });
  }

  getNotificationSince(notification): Observable<PrometheusNotification[]> {
    return this.http.post<PrometheusNotification[]>(
      `${this.baseURL}/get_notifications_since`,
      notification
    );
  }
}

result-matching ""

    No results matching ""