Created
January 25, 2016 12:57
-
-
Save confiq/b59b0c56ff16e15d4c12 to your computer and use it in GitHub Desktop.
send message to 0mq
This file contains 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
import zmq | |
import datetime | |
def _init(): | |
myzmq = zmq.Context.instance() | |
publisher = myzmq.socket(zmq.PUB) | |
publisher.connect("tcp://10.0.100.132:2120") | |
message = { | |
"@source": __file__, | |
"@tags": ["dump_tag", "can_send_email_is_false"], | |
"@timestamp": datetime.datetime.now().isoformat(), | |
"@type": 'SelfCheck', | |
"@fields": '{"field"=>value}', | |
"@source_host": 'HostX', | |
"@message": '2015-12-02 05:18:45,742 staging-1:\t[BaseService:getApiSpec:93]\tDEBUG\tgetApiSpec was called and yayayayay\t' | |
} | |
publisher.send_json(message) | |
if __name__ == '__main__': | |
_init() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment