feat(profile): add vmstat

This commit is contained in:
Alexandre Pujol 2025-07-07 00:30:21 +02:00
parent 771dd9b589
commit c85ed58fa9
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
2 changed files with 52 additions and 0 deletions

View file

@ -0,0 +1,27 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2025 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/4.0>,
include <tunables/global>
@{exec_path} = @{bin}/vmstat
profile vmstat @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
@{exec_path} mr,
@{sys}/block/ r,
@{sys}/devices/system/node/ r,
@{PROC}/diskstats r,
@{PROC}/slabinfo r,
@{PROC}/uptime r,
@{PROC}/vmstat r,
include if exists <local/vmstat>
}
# vim:syntax=apparmor

View file

@ -0,0 +1,25 @@
#!/usr/bin/env bats
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2024 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
load ../common
@test "vmstat: Display virtual memory statistics" {
vmstat
vmstat --active
vmstat --forks
}
@test "vmstat: Display disk statistics" {
vmstat --disk
vmstat --disk-sum
}
@test "vmstat: Display slabinfo" {
sudo vmstat --slabs
}
@test "vmstat: Display reports every second for 3 times" {
vmstat 1 3
}