Skip to content

Instantly share code, notes, and snippets.

@plewin
Created August 29, 2017 23:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plewin/2808ddbd32bcb756e5ba84da51b2ad6a to your computer and use it in GitHub Desktop.
Save plewin/2808ddbd32bcb756e5ba84da51b2ad6a to your computer and use it in GitHub Desktop.
#!/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()
@RGSpie
Copy link

RGSpie commented Nov 20, 2018

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment