Skip to content

Commit

Permalink
Closes #60
Browse files Browse the repository at this point in the history
  • Loading branch information
csavelief committed Aug 9, 2024
1 parent 7aaf5c1 commit ae8f68f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Models/YnhServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@ public function sshInstallOsquery(SshConnection2 $ssh)
cat /etc/osquery/osquery.conf | \
jq $'del(.schedule.socket_events)' | \
jq $'del(.schedule.network_interfaces_snapshot)' | \
jq $'del(.schedule.process_events)' | \
jq $'.schedule.packages_available_snapshot += {query:"SELECT name, version, source FROM deb_packages;",interval:86400,snapshot:true}' | \
jq $'.schedule.memory_available_snapshot += {query:"select printf(\'%.2f\',((memory_total - memory_available) * 1.0)/1073741824) as used_space_gb, printf(\'%.2f\',(1.0 * memory_available / 1073741824)) as space_left_gb, printf(\'%.2f\',(1.0 * memory_total / 1073741824)) as total_space_gb, printf(\'%.2f\',(((memory_total - memory_available) * 1.0)/1073741824)/(1.0 * memory_total / 1073741824)) * 100 as \'%_used\', printf(\'%.2f\',(1.0 * memory_available / 1073741824)/(1.0 * memory_total / 1073741824)) * 100 as \'%_available\' from memory_info;",interval:300,snapshot:true}' | \
jq $'.schedule.disk_available_snapshot += {query:"select printf(\'%.2f\',((blocks - blocks_available * 1.0) * blocks_size)/1073741824) as used_space_gb, printf(\'%.2f\',(1.0 * blocks_available * blocks_size / 1073741824)) as space_left_gb, printf(\'%.2f\',(1.0 * blocks * blocks_size / 1073741824)) as total_space_gb, printf(\'%.2f\',(((blocks - blocks_available * 1.0) * blocks_size)/1073741824)/(1.0 * blocks * blocks_size / 1073741824)) * 100 as \'%_used\', printf(\'%.2f\',(1.0 * blocks_available * blocks_size / 1073741824)/(1.0 * blocks * blocks_size / 1073741824)) * 100 as \'%_available\' from mounts where path = \'/\';",interval:300,snapshot:true}' \
Expand Down Expand Up @@ -802,7 +803,7 @@ public function addOsqueryEvents(array $events): int
$nbEvents = 0;

foreach ($events as $event) {
if (in_array($event['name'], ['socket_events', 'network_interfaces_snapshot'])) {
if (in_array($event['name'], ['socket_events', 'network_interfaces_snapshot', 'process_events'])) {
continue;
}
YnhOsquery::create([
Expand Down

0 comments on commit ae8f68f

Please sign in to comment.