LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-21-2015, 06:59 AM   #1
624867243@qq.com
Member
 
Registered: Nov 2015
Location: ShenZhen
Posts: 33
Blog Entries: 1

Rep: Reputation: Disabled
How to modify the zabbix script?


I use zabbix as a monitor, but i have a problem, when the zabbix send Alarm email,then the email would send by SMS to my iphone. If the email title is Japanese or Chinese. the sms is Disorder Code. Here is the scripts,how to modify it?

Code:
#!/usr/bin/python26
#coding:utf-8
import smtplib
from email.mime.text import MIMEText
import sys
mail_host = 'smtp.189.cn'
mail_user = 'Tom_a'
mail_pass = '123456'
mail_postfix = '189.cn'
def send_mail(to_list,subject,content):
  me = mail_user+"<"+mail_user+"@"+mail_postfix+">"
  msg = MIMEText(content,_subtype='plain',_charset='utf-8')
  msg['Subject'] = subject
  msg['From'] = me
  msg['to'] = to_list
  try:
    s = smtplib.SMTP()
    s.connect(mail_host)
    s.login(mail_user,mail_pass)
    s.sendmail(me,to_list,msg.as_string())
    s.close()
    return True
  except Exception,e:
    print str(e)
    return False
if __name__ == "__main__":
  send_mail(sys.argv[1], sys.argv[2], sys.argv[3])
 
Old 11-22-2015, 10:33 AM   #2
624867243@qq.com
Member
 
Registered: Nov 2015
Location: ShenZhen
Posts: 33

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
No one know how to modify?
 
Old 11-24-2015, 08:58 AM   #3
morrolan
Member
 
Registered: Sep 2003
Location: Manchester UK
Posts: 264

Rep: Reputation: 30
Hey, long time Zabbix admin and python dev here. In order to help you, I would like to ask a few questions:
  • Are you using the default Media types in Zabbix?
  • What SMS provider are you using, and how have you incorporated it into Zabbix (custom scripts etc)?
  • Just to clarify what you mean, when Zabbix triggers a particular category/trigger, it sends an email. Does it send the SMS via the same Alert, or is the SMS configured independently?
  • I am unsure what you mean by " If the email title is Japanese or Chinese. the sms is Disorder Code." - please can you elaborate? Do you mean that if the email title is in Japanese or Chinese then it produces some kind of error?

Many thanks!
 
Old 11-25-2015, 10:25 AM   #4
624867243@qq.com
Member
 
Registered: Nov 2015
Location: ShenZhen
Posts: 33

Original Poster
Blog Entries: 1

Rep: Reputation: Disabled
(1)I have used the default Media types in Zabbix.
(2)but i use emali,then email would send to my iphone,because it is free,189 mail or 139 mail has a free fucnction,so i want to send email,then the email woul send to my iphone autolly.
(3) it send the email not by SMS.
(4)the title contains Visible name and the Visible name is Chinese. it is Disorder Code,I think it had nothing to do with zabbix;
for example,I use a test mail,
python sendmail.py knight@189.cn "北方" "正文", then my 189 mailbox have recived,then the mail would send infomation to my ipone autoly and freely.
but my iphone show the title is Disorder Code,and the body is normal.



Quote:
Originally Posted by morrolan View Post
Hey, long time Zabbix admin and python dev here. In order to help you, I would like to ask a few questions:
  • Are you using the default Media types in Zabbix?
  • What SMS provider are you using, and how have you incorporated it into Zabbix (custom scripts etc)?
  • Just to clarify what you mean, when Zabbix triggers a particular category/trigger, it sends an email. Does it send the SMS via the same Alert, or is the SMS configured independently?
  • I am unsure what you mean by " If the email title is Japanese or Chinese. the sms is Disorder Code." - please can you elaborate? Do you mean that if the email title is in Japanese or Chinese then it produces some kind of error?

Many thanks!
 
  


Reply

Tags
linux, python, zabbix



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
zabbix - postfix: postfix is running but can't see info from it on zabbix eantoranz Linux - Server 32 02-27-2013 05:28 PM
Modify script ust Linux - Newbie 2 05-21-2012 03:57 AM
modify the perl script so that I could apply the script to all the files casualzone Linux - Software 3 05-06-2011 04:23 AM
Need to write a Shell Script for Zabbix Application Level Clustering vinaytp Linux - Newbie 4 08-17-2010 06:37 AM
Modify Perl script to work with txt - Permissions script joangopan Programming 4 09-14-2007 09:20 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 11:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration