plynte / tcp_port_exporter Goto Github PK
View Code? Open in Web Editor NEW检测端口存活 Prometheus_client Practice
检测端口存活 Prometheus_client Practice
tcp_port_exporter.py[16478]: Traceback (most recent call last):
tcp_port_exporter.py[16478]: File "/opt/prometheus/tcp_port_exporter.py", line 7, in
tcp_port_exporter.py[16478]: from prometheus_client.core import GaugeMetricFamily, _floatToGoString
tcp_port_exporter.py[16478]: ImportError: cannot import name _floatToGoString
systemd[1]: tcp_port_exporter.service: control process exited, code=exited status=1
systemd[1]: Failed to start TCP_Port_Exporter.
Install requirements.txt packages.
NO start tcp_port_exporter.service. Help me.
LOG_LEVEL = 'DEBUG' if DEBUG else 'WARNING'
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'verbose': {
'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
},
'main': {
'datefmt': '%Y-%m-%d %H:%M:%S',
'format': '%(asctime)s [%(module)s %(levelname)s] %(message)s',
},
'simple': {
'format': '%(levelname)s %(message)s'
},
},
'filters': {
},
'handlers': {
'null': {
'level': 'DEBUG',
'class': 'logging.NullHandler',
},
'mail_admins': {
'level': 'DEBUG',
'class': 'django.utils.log.AdminEmailHandler',
'include_html': True,
},
'console': {
'level': 'DEBUG',
'class': 'logging.StreamHandler',
'formatter': 'main'
},
'default': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'formatter': 'main',
'filename': os.path.join(BASE_DIR, 'logs', 'output.log')
},
'myhandler': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'formatter': 'main',
'filename': os.path.join(BASE_DIR, 'logs', 'azurecloudapi.log')
},
},
'loggers': {
# loggers 类型 为"django" 这将处理所有类型的日志
'django': {
'handlers': ['null'],
'propagate': False,
'level': LOG_LEVEL,
},
'django.request': {
'handlers': ['console', 'default'],
'level': LOG_LEVEL,
'propagate': False,
},
'django.server': {
'handlers': ['console', 'default'],
'level': LOG_LEVEL,
'propagate': False,
},
'mylogger': {
'handlers': ['console', 'myhandler'],
'level': LOG_LEVEL,
},
}
}
- formatters
定义日志输出的具体格式- handlers
定义如何处理日志,比如发送到文件,console等- filters
定义一个日志记录是否发送到handler- loggers
记录日志接口,供代码使用
import logging
# logger = logging.getLogger(str('mylogger'))
logger = logging.getLogger(__name__) # 用__name__通用,自动检测
def test():
logger.debug()
logger.info()
logger.warning()
logger.error()
logger.critical()
#...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.