Skip to content

Commit

Permalink
Use negative value to fetch alert items. Fixes issue #79
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscareycode committed May 25, 2024
1 parent e9dc68a commit 819b28a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/components/alerts/AlertSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,18 @@ const AlertSection = () => {
const fetchAlertData = () => {
const starttime = alertDaysBack * 60 * 60 * 24;

let url;
let url = '';
// let endtime = '%2B0'; // +0
let endtime = '%2D0'; // -0

if (useFakeSampleData) {
url = './sample-data/alertlist.json';
} else if (clientSettings.dataSource === 'livestatus') {
url = clientSettings.livestatusPath + `?query=alertlist&starttime=-${starttime}&endtime=%2B`;
url = clientSettings.livestatusPath + `?query=alertlist&starttime=-${starttime}&endtime=${endtime}`;
if (hostgroupFilter) { url += `&hostgroup=${hostgroupFilter}`; }
if (servicegroupFilter) { url += `&servicegroup=${servicegroupFilter}`; }
} else {
url = `${clientSettings.baseUrl}archivejson.cgi?query=alertlist&starttime=-${starttime}&endtime=%2B0`;
url = `${clientSettings.baseUrl}archivejson.cgi?query=alertlist&starttime=-${starttime}&endtime=${endtime}`;
if (hostgroupFilter) { url += `&hostgroup=${hostgroupFilter}`; }
if (servicegroupFilter) { url += `&servicegroup=${servicegroupFilter}`; }
}
Expand Down

0 comments on commit 819b28a

Please sign in to comment.