我在 CentOS 机器上运行。
有一些东西(一个 cron 作业,Jenkins 作业,不确定)正在访问我的服务器,但我不知道是哪个服务器。每 5 分钟,我就会看到一些如下的日志消息:
2017-03-31 08:49:15,696 - [INFO] - from application in Timer-1
Application: checkBD2Health end - true
2017-03-31 08:54:13,878 - [INFO] - from application in Timer-1
ChartManager: getIncompleteJobs request select chartID,userEmail from dashboard.saved_charts_staging where queryComplete = 0
2017-03-31 08:54:14,545 - [INFO] - from application in Timer-1
ChartManager: getIncompleteJobs success with 0 incomplete jobs.
2017-03-31 08:54:14,545 - [INFO] - from application in Timer-1
ChartManager: Checked QueryNow background jobs.
2017-03-31 08:54:14,546 - [INFO] - from application in Timer-1
Application: checkBD2Health initial - true
2017-03-31 08:54:14,546 - [INFO] - from application in Timer-1
Application: bd2Endpoint
2017-03-31 08:54:14,546 - [INFO] - from application in Timer-1
Application: bd2Endpoint - http://server.domainname.com:9090/job/request?dataSource=impala&webDataFormat=CSV&sqlStatement=select count(*) from bigdata.cmdb
2017-03-31 08:54:15,631 - [INFO] - from application in Timer-1
Application: checkBD2Health - 200 count(*)
27066092
2017-03-31 08:54:15,632 - [INFO] - from application in Timer-1
Application: checkBD2Health end - true
2017-03-31 08:59:13,878 - [INFO] - from application in Timer-1
ChartManager: getIncompleteJobs request select chartID,userEmail from dashboard.saved_charts_staging where queryComplete = 0
我前往 server.domainname.com 寻找名为 bd2Endpoint 和 checkBD2Health 的工作,但在 Jenkins 或服务帐户的 crontab 中没有找到任何内容。
我尝试检查 /var/log/secure 文件,但有人通过 ssh 访问服务器的时间与日志中的时间不匹配。
无论如何,回到我最初的问题,有没有办法告诉谁或什么连接到我的服务器(不是 ssh)?
答案1
netstat -pan
将显示正在使用的端口以及正在使用它们的进程。
watch netstat -pan
将动态显示该信息,并可以帮助您找出正在访问您的服务器的内容。