-
Notifications
You must be signed in to change notification settings - Fork 44
/
Makefile
67 lines (59 loc) · 2.06 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# These assume you hav Docker installed and running
SHELL = bash
all: build start setupelk
build:
@echo -ne "Building crawler container..."
@docker build -t crawler . 1>/dev/null
@if [ $$? -eq 0 ];then echo "[OK]";else echo "[FAILED]"; fi
start:
@echo -ne "Starting crawler container..."
@docker run \
--privileged \
--net=host \
--pid=host \
--name agentless-crawler\
-v /cgroup:/cgroup:ro \
-v /var/lib/docker:/var/lib/docker:ro \
-v /sys/fs/cgroup:/sys/fs/cgroup:ro \
-v /var/run/docker.sock:/var/run/docker.sock \
-it -d crawler \
--url "http://127.0.0.1:8080/crawler/data"\
--features os,disk,process\
--frequency 5\
--format json\
--crawlmode OUTCONTAINER\
1>/dev/null
@echo "[OK]"
setupelk:
@echo -ne "Building elk container..."
@docker build -t crawler-elk -f Dockerfile.elk . 1>/dev/null
@if [ $$? -eq 0 ];then echo "[OK]";else echo "[FAILED]"; fi
@echo -ne "Starting elk container..."
@docker run -d -p 5601:5601 -p 9200:9200 -p 5044:5044 -p 5000:5000 -p 8080:8080 --name elk crawler-elk 1>/dev/null
@echo "[OK]"
@#sleep is added to allow time for elk components to bootstrap
@#before crawler can send data to it
@sleep 2
@echo "You can view the crawl data at http://localhost:5601/app/kibana"
@echo "Please create an index by @timestamp on kibana dashboard"
.PHONY: test
test:
@if [ ! -d psvmi ]; then git clone https://github.com/cloudviz/psvmi.git; fi
docker build -t agentless-system-crawler-test -f Dockerfile.test .
docker run --privileged -ti --rm agentless-system-crawler-test
unit:
python2.7 setup.py test --addopts '--fulltrace --cov=. tests/unit'
functional:
python2.7 setup.py test --addopts '--fulltrace --cov=. tests/functional'
clean:
@echo -ne "Stopping and removing crawler container..."
@docker stop agentless-crawler 1>/dev/null
@docker rm agentless-crawler 1>/dev/null
@echo "[OK]"
@echo -ne "Stopping and removing elk container..."
@docker stop elk>/dev/null
@docker rm elk 1>/dev/null
@echo "[OK]"
covreport: unit
coverage html -i
$(info ************ Please open htmlcov/index.html ************)