Add limit 1 to disk space queries (#2063)

This commit is contained in:
Tomas Touceda 2021-09-14 18:17:52 -03:00 committed by GitHub
parent e9d3460877
commit 15cf91dcc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View file

@ -0,0 +1 @@
* Ensure only one row is returned when checking for disk space in hosts.

View file

@ -340,7 +340,7 @@ var detailQueries = map[string]DetailQuery{
Query: `
SELECT (blocks_available * 100 / blocks) AS percent_disk_space_available,
round((blocks_available * blocks_size *10e-10),2) AS gigs_disk_space_available
FROM mounts WHERE path = '/';`,
FROM mounts WHERE path = '/' LIMIT 1;`,
Platforms: []string{"darwin", "linux", "rhel", "ubuntu", "centos"},
IngestFunc: ingestDiskSpace,
},
@ -348,7 +348,7 @@ FROM mounts WHERE path = '/';`,
Query: `
SELECT ROUND((sum(free_space) * 100 * 10e-10) / (sum(size) * 10e-10)) AS percent_disk_space_available,
ROUND(sum(free_space) * 10e-10) AS gigs_disk_space_available
FROM logical_drives WHERE file_system = 'NTFS';`,
FROM logical_drives WHERE file_system = 'NTFS' LIMIT 1;`,
Platforms: []string{"windows"},
IngestFunc: ingestDiskSpace,
},