Created
August 29, 2017 23:18
-
-
Save plewin/2808ddbd32bcb756e5ba84da51b2ad6a to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/env python | |
from ConfigParser import RawConfigParser | |
import json | |
import StringIO | |
import socket | |
import sys | |
to = sys.argv[1] | |
subject = sys.argv[2] | |
body = sys.argv[3] | |
config = RawConfigParser() | |
ini_fp = StringIO.StringIO(body) | |
config.readfp(ini_fp) | |
json_data = json.dumps(config._sections['zabbix_data']) | |
TCP_IP = to | |
TCP_PORT = int(subject) | |
BUFFER_SIZE = 1024 | |
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
s.connect((TCP_IP, TCP_PORT)) | |
s.send(json_data) | |
s.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I have try to do your tutoriel to Send Zabbix events to Logstash and I have a problem. When I try to send log, nothing is happening.
The only difference with your tutoriel is IP address and port number for Logstash.