A tutorial from scratch to writing your own alerts using alerta.io.
In [ ]:
from IPython.display import HTML
HTML('<iframe src="http://alerta.io" width="100%" height="500"></iframe>')
In [ ]:
from IPython.display import HTML
HTML('<iframe src="http://localhost:8090" width="100%" height="500"></iframe>')
In [ ]:
from IPython.display import HTML
HTML('<iframe src="http://localhost:8095" width="100%" height="500"></iframe>')
In [ ]:
! cd $ALERTA_TEST_DIR && ./miniconda2/bin/alerta \
--endpoint-url "http://localhost:8090" \
send -E Production -r localhost -e VolUnavailable \
-S Filesystem -v ERROR -s minor \
-t "/Volumes/XYZ not available."
In [ ]:
! cd $ALERTA_TEST_DIR && ./miniconda2/bin/alerta \
--endpoint-url "http://localhost:8090" \
delete
In [ ]:
from alerta.api import ApiClient
from alerta.alert import Alert
api = ApiClient(endpoint='http://localhost:8090')
alert = Alert(resource='localhost', event='VolUnavailable',
service=['Filesystem'], environment='Production',
value='ERROR', severity='minor')
res = api.send(alert)
In [ ]:
import utils
utils.volume_is_mounted('/Volumes/Intenso64')
In [ ]:
utils.internet_available()
In [ ]:
utils.using_vpn(city='Berlin', country='Germany')
In [ ]:
utils.get_python_sites_status()
In [ ]:
from IPython.display import HTML
HTML('<iframe src="https://status.python.org" width="100%" height="500"></iframe>')
In [ ]:
utils.get_webpage_info('http://www.python.org', title_contains='Python')
In [ ]:
import sys
from os.path import join, dirname
In [ ]:
conda_path = join(dirname(sys.executable), 'conda')
conda_path
In [ ]:
utils.get_conda_list(conda_path)
In [ ]:
utils.get_conda_updates(conda_path)
In [ ]:
ks_url = 'https://www.kickstarter.com/projects/udoo/udoo-x86-the-most-powerful-maker-board-ever/'
utils.get_kickstarter_days_left(ks_url)
# uses Firefox as it doesn't need a special driver installation
In [ ]:
phantomjs_path = './alerta_test_directory/phantomjs-2.1.1-macosx/bin/phantomjs'
browser = utils.webdriver.PhantomJS(phantomjs_path)
utils.get_kickstarter_days_left(ks_url, browser)
In [ ]:
from IPython.display import HTML
HTML('<iframe src="http://localhost:8095" width="100%" height="500"></iframe>')
In [ ]:
import my_alerts as ma
ma.start(list=True)
In [ ]:
rts = ma.start(name='alert_conda_outdated')
rts
In [ ]:
import subprocess
cmd = "%s install -y sqlite==3.8.4.1" % conda_path
print subprocess.check_output(cmd.split())
In [ ]:
cmd = "%s update -y sqlite" % conda_path
print subprocess.check_output(cmd.split())
In [ ]:
rts[0].stop()