[关闭]
@lsyAndroid 2019-05-12T23:46:41.000000Z 字数 9728 阅读 1209

zabbix+grafana进行服务监控和参数图形化展示

运维向


运行环境

Linux

CentOS7.6,内核版本3.1,承载Nginx服务和Zabbix+Grafana服务

WinServer

监控信息--利用zabbix进行服务监控

grafana抓取zabbix数据

zabbix+grafana进行服务监控和参数图形化展示

标签(空格分隔): 运维向


运行环境

Linux

CentOS7.6,内核版本3.10,承载Nginx服务和Zabbix+Grafana服务。需要注意的是,Docker 目前支持 CentOS 7 及以后的版本,内核要求至少为 3.10。

WinServer

监控信息--利用zabbix进行服务监控

至此,zabbix服务端就部署完毕了,可以通过浏览器访问localhost:80进行访问了。

```

查看当前系统 Docker 信息

docker info

拉取 docker 镜像

docker pull image_name

从 Docker hub 上下载某个镜像

docker pull centos:latest

查看宿主机上的镜像,Docker 镜像保存在 / var/lib/docker 目录下:

docker images

REPOSITORY TAG IMAGE ID CREATED SIZE
mysql 5.7 1b30b36ae96a 8 days ago 372MB
zabbix/zabbix-web-nginx-mysql centos-4.0-latest 8be5f91b2fa1 3 weeks ago 415MB
zabbix/zabbix-server-mysql centos-4.0-latest 8e5becf45c4e 3 weeks ago 326MB

删除镜像

docker rmi image_name/image_id
docker rmi zabbix/zabbix-web-nginx-mysql:centos-4.0-latest 或者 docker rmi 8be5f91b2fa1

查看当前有哪些容器正在运行

docker ps

查看所有容器

docker ps -a

CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
b30307ad65be zabbix/zabbix-web-nginx-mysql:centos-4.0-latest "docker-entrypoint.sh" 7 days ago Exited (255) 8 minutes ago 443/tcp, 0.0.0.0:8080->80/tcp zabbix-web-nginx-mysql
0ad822cd52b7 zabbix/zabbix-server-mysql:centos-4.0-latest "docker-entrypoint.sh" 7 days ago Exited (255) 8 minutes ago 0.0.0.0:10051->10051/tcp zabbix-server-mysql
d01c89a112f7 mysql:5.7 "docker-entrypoint.s…" 7 days ago Exited (255) 8 minutes ago 3306/tcp, 33060/tcp mysql-server

启动、停止、重启容器命令:

docker start container_name/container_id
docker stop container_name/container_id
docker restart container_name/container_id

后台启动一个容器后,如果想进入到这个容器,可以使用 attach

docker attach container_name/container_id

删除容器

docker rm container_name/container_id

查看容器日志

docker logs -f container_name/container_id

查看容器 IP 地址

docker inspect container_name/container_id

进入容器

docker exec -it container_name/container_id bash

从 Docker 容器与宿主机相互传输文件

[root@localhost tmp]# docker cp --help

Usage: docker cp [OPTIONS] CONTAINER:SRC_PATH DEST_PATH|-
docker cp [OPTIONS] SRC_PATH|- CONTAINER:DEST_PATH

Copy files/folders between a container and the local filesystem

docker cp zabbix_config.sql mysql-server:/tmp
docker cp mysql-server:/tmp/zabbix_config.sql /tmp

批量删除所有已经退出的容器

docker rm -v $(docker ps -aq -f status=exited)

docker help

[root@centos7lined1 wangao]# docker help

Usage: docker [OPTIONS] COMMAND

A self-sufficient runtime for containers

Options:
--config string Location of client config files (default "/root/.docker")
-D, --debug Enable debug mode
-H, --host list Daemon socket(s) to connect to
-l, --log-level string Set the logging level ("debug"|"info"|"warn"|"error"|"fatal") (default "info")
--tls Use TLS; implied by --tlsverify
--tlscacert string Trust certs signed only by this CA (default "/root/.docker/ca.pem")
--tlscert string Path to TLS certificate file (default "/root/.docker/cert.pem")
--tlskey string Path to TLS key file (default "/root/.docker/key.pem")
--tlsverify Use TLS and verify the remote
-v, --version Print version information and quit

Management Commands:
config Manage Docker configs
container Manage containers
image Manage images
network Manage networks
node Manage Swarm nodes
plugin Manage plugins
secret Manage Docker secrets
service Manage services
stack Manage Docker stacks
swarm Manage Swarm
system Manage Docker
trust Manage trust on Docker images
volume Manage volumes

Commands:
attach Attach local standard input, output, and error streams to a running container
build Build an image from a Dockerfile
commit Create a new image from a container's changes
cp Copy files/folders between a container and the local filesystem
create Create a new container
diff Inspect changes to files or directories on a container's filesystem
events Get real time events from the server
exec Run a command in a running container
export Export a container's filesystem as a tar archive
history Show the history of an image
images List images
import Import the contents from a tarball to create a filesystem image
info Display system-wide information
inspect Return low-level information on Docker objects
kill Kill one or more running containers
load Load an image from a tar archive or STDIN
login Log in to a Docker registry
logout Log out from a Docker registry
logs Fetch the logs of a container
pause Pause all processes within one or more containers
port List port mappings or a specific mapping for the container
ps List containers
pull Pull an image or a repository from a registry
push Push an image or a repository to a registry
rename Rename a container
restart Restart one or more containers
rm Remove one or more containers
rmi Remove one or more images
run Run a command in a new container
save Save one or more images to a tar archive (streamed to STDOUT by default)
search Search the Docker Hub for images
start Start one or more stopped containers
stats Display a live stream of container(s) resource usage statistics
stop Stop one or more running containers
tag Create a tag TARGET_IMAGE that refers to SOURCE_IMAGE
top Display the running processes of a container
unpause Unpause all processes within one or more containers
update Update configuration of one or more containers
version Show the Docker version information
wait Block until one or more containers stop, then print their exit codes

````

注意:
1. agent部分所在服务器要开放10050和10051端口
2. agent部分所在服务器的配置文件内的Hostname,同创建主机时主机名称一致,如果不一致,无法看到主机的监控数据
3.

grafana抓取zabbix数据

参考文章

添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注