-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
351 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ all: | |
|
||
start_service: | ||
./runimages.sh | ||
|
||
clean_data: | ||
rm ./dao/data.db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
eBPF_Visualization/eBPF_prometheus/collector/collect_tmux.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
// Copyright 2023 The LMP Authors. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://github.com/linuxkerneltravel/lmp/blob/develop/LICENSE | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// author: Gui-Yue | ||
// | ||
// 为lock_image所做的适配的收集器 | ||
|
||
package collector | ||
|
||
import ( | ||
"bufio" | ||
"ebpf_prometheus/checker" | ||
"github.com/urfave/cli/v2" | ||
"io" | ||
"strings" | ||
) | ||
|
||
type Tmux_Setting struct { | ||
Name string `yaml:"tmux_name"` | ||
Path string `yaml:"tmux_path"` | ||
Pid string `yaml:"tmux_pid"` | ||
Max_Records int `yaml:"tmux_max_records"` | ||
} | ||
|
||
var tmux_command = cli.Command{ | ||
Name: "tmux", | ||
Usage: "Special collect data out from lock_image", | ||
Action: tmuxCollect, | ||
} | ||
|
||
func tmuxCollect(ctx *cli.Context) error { | ||
_, command, _ := Get_Setting("tmux") | ||
return ProcRun(command) | ||
} | ||
|
||
func redirectTmux(stdout io.ReadCloser, mapchan chan map[string]interface{}) { | ||
controler := 0 | ||
scanner := bufio.NewScanner(stdout) | ||
onemap := make(map[string]interface{}) | ||
|
||
for scanner.Scan() { | ||
line := scanner.Text() | ||
line = checker.CutunexceptedSpace(line) | ||
|
||
if controler == 0 { | ||
if checker.Istmuxlineone(line) { | ||
parms := strings.Fields(line) | ||
for _, value := range parms { | ||
parts := strings.Split(value, ":") | ||
onemap[parts[0]] = parts[1] | ||
controler = 1 | ||
} | ||
} | ||
} else { | ||
if checker.Istmuxlinetwo(line) { | ||
parms := strings.Fields(line) | ||
for _, value := range parms { | ||
parts := strings.Split(value, ":") | ||
onemap[parts[0]] = parts[1] | ||
controler = 0 | ||
} | ||
mapchan <- onemap | ||
onemap = make(map[string]interface{}) | ||
} | ||
} | ||
} | ||
} |
4 changes: 0 additions & 4 deletions
4
eBPF_Visualization/eBPF_prometheus/collector/proc_setting.yaml
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
eBPF_Visualization/eBPF_prometheus/collector/tmux_proc_setting.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
proc_name: proc_image | ||
proc_path: ~/tmp/proc_image/proc_image | ||
proc_pid: 22896 | ||
proc_max_records: 20 # 一次展示的最大数量 | ||
|
||
tmux_name: tmux | ||
tmux_path: /root/lmp/eBPF_Supermarket/eBPF_proc_image/lock_image | ||
tmux_pid: 20080 | ||
tmux_max_records: 200 # 一次展示的最大数量 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.