TECHZEN Zenoss User Community ARCHIVE  

script for allerting when the device goes down

Subject: script for allerting when the device goes down
Author: [Not Specified]
Posted: 2016-09-06 11:43

Hi,

i tried to run the script which should send an email alert and text message to mobile when the device is down.

but i failed to run the script and i need help tofix the script and how to automate the script in zenoss through commandline

for device in dmd.Devices.Server.Linux.getSubDevices():
status = "up"
if device.getPingStatus() != 0:
status = "down"
content = ("Server Down fix it")
mail = smtplib.SMTP('smtp.w2.samsung.com',995)
mail.ehlo()
mail.starttls()
mail.login('email id','paswword')
mail.sendmail('from email id',''to email id,content)
mail.close()
print("Sent")
print "%s,%s" % (device.id, status)

commit()



Subject: Why not use triggers
Author: Jay Stanley
Posted: 2016-09-06 15:28

Why not use triggers/notificationsIt is what they are there for.



Subject: thanku
Author: [Not Specified]
Posted: 2016-09-06 15:51

thanku

i would like to prefer in command line than gui

i need help in how to trigger through the command line



Subject: Why? Zenoss has built-in
Author: Jay Stanley
Posted: 2016-09-07 07:32

Why Zenoss has built-in functionality for exactly what you are trying to do



< Previous
SNMP and Windows services/event log errors
  Next
Problem with option STACK in graphpoints
>