Skip to content

Commit 8e85eb5

Browse files
committed
ClamAV: add artifact to report services not running
1 parent fb84ec8 commit 8e85eb5

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: SUSE.Linux.Events.ClamAVServices
2+
3+
description: |
4+
This artifact checks the ClamAV systemd services every
5+
`check_period` seconds and generate a row for each one
6+
found not to be running.
7+
8+
type: CLIENT_EVENT
9+
10+
required_permissions:
11+
- EXECVE
12+
13+
parameters:
14+
- name: check_period
15+
description: Time between checks in seconds.
16+
type: int
17+
default: 7200
18+
- name: services
19+
description: List of ClamAV services to check.
20+
type: json_array
21+
default: '["clamd", "clamonacc", "freshclam"]'
22+
23+
sources:
24+
- precondition:
25+
SELECT OS From info() WHERE OS = 'linux'
26+
27+
query: |
28+
LET is_active(service) = SELECT *
29+
FROM execve(argv=["systemctl", "is-active", "--quiet", service])
30+
WHERE ReturnCode = 0
31+
32+
SELECT * FROM foreach(
33+
row={
34+
SELECT * FROM clock(start=0, period=check_period)
35+
},
36+
query={
37+
SELECT * FROM foreach(
38+
row={
39+
SELECT _value AS service FROM items(item=services)
40+
},
41+
query={
42+
SELECT format(format="%s is not running", args=[service]) AS Message
43+
FROM scope()
44+
WHERE NOT is_active(service=service)
45+
}
46+
)
47+
}
48+
)

0 commit comments

Comments
 (0)