apis.tsx 637 B

123456789101112131415161718192021222324252627282930
  1. import { getBackendSrv } from '@grafana/runtime';
  2. export interface ServerStat {
  3. activeAdmins: number;
  4. activeEditors: number;
  5. activeSessions: number;
  6. activeUsers: number;
  7. activeViewers: number;
  8. admins: number;
  9. alerts: number;
  10. dashboards: number;
  11. datasources: number;
  12. editors: number;
  13. orgs: number;
  14. playlists: number;
  15. snapshots: number;
  16. stars: number;
  17. tags: number;
  18. users: number;
  19. viewers: number;
  20. }
  21. export const getServerStats = async (): Promise<ServerStat | null> => {
  22. return getBackendSrv()
  23. .get('api/admin/stats')
  24. .catch((err) => {
  25. console.error(err);
  26. return null;
  27. });
  28. };