Overview
Comment: | cleanup telemetry-daemon |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | v1.65-telemetry |
Files: | files | file ages | folders |
SHA1: |
c31defc65c58e2de9b022f250deac627 |
User & Date: | bjbarcla on 2019-02-13 19:08:31 |
Other Links: | branch diff | manifest | tags |
Context
2019-02-14
| ||
14:18 | defend against issue in test execution >>Error: (hash-table->alist) bad argument type - not a structure of the required type << check-in: ca98414851 user: bjbarcla tags: v1.65-telemetry | |
2019-02-13
| ||
19:08 | cleanup telemetry-daemon check-in: c31defc65c user: bjbarcla tags: v1.65-telemetry | |
19:03 | ensured telemetry logging does not happen if no mention in megatest.config check-in: c4fac28c5c user: bjbarcla tags: v1.65-telemetry | |
Changes
Modified telemetry-daemon from [809d3fc45a] to [a2b1d26b8f].
1 2 3 4 5 6 7 | #!/usr/bin/env python # -*- Mode: Python; -*- ## Tiny Syslog Server in Python. ## ## This is a tiny syslog server that is able to receive UDP based syslog ## entries on a specified port and save them to a file. ## That's it... it does nothing else... | | < < < < < < < < < < < > | 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 | #!/usr/bin/env python # -*- Mode: Python; -*- ## Tiny Syslog Server in Python. ## ## This is a tiny syslog server that is able to receive UDP based syslog ## entries on a specified port and save them to a file. ## That's it... it does nothing else... import os import sys, os, time, atexit from signal import SIGTERM import logging import logging.handlers import SocketServer import datetime from subprocess import call import argparse import os import socket ## code to determine this host's IP on non-loopback interface if os.name != "nt": import fcntl import struct def get_interface_ip(ifname): s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) return socket.inet_ntoa(fcntl.ioctl(s.fileno(), 0x8915, struct.pack('256s', |
︙ | ︙ | |||
182 183 184 185 186 187 188 | def run(self): """ You should override this method when you subclass Daemon. It will be called after the process has been daemonized by start() or restart(). """ | | < < < < < < | 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | def run(self): """ You should override this method when you subclass Daemon. It will be called after the process has been daemonized by start() or restart(). """ # setup logging module so that the log can be moved aside and will reopen for append def log_setup(logfile): log_handler = logging.handlers.WatchedFileHandler(logfile) formatter = logging.Formatter( '%(message)s','') log_handler.setFormatter(formatter) logger = logging.getLogger() logger.addHandler(log_handler) logger.setLevel(logging.INFO) class SyslogUDPHandler(SocketServer.BaseRequestHandler): def handle(self): data = bytes.decode(self.request[0].strip()) socket = self.request[1] print( "%s : " % self.client_address[0], str(data)) timestamp = datetime.datetime.now().isoformat() |
︙ | ︙ |