13
Monitoring for Web Applications Контроль и мониторинг Linux процессов для Рython разработчиков

Linux processes control and monitoring

Embed Size (px)

DESCRIPTION

Контроль и мониторинг Linux процессов для Рython разработчиков

Citation preview

Page 1: Linux processes control and monitoring

Monitoring for Web Applications

Контроль и мониторинг Linux процессов для Рython разработчиков

Page 2: Linux processes control and monitoring
Page 3: Linux processes control and monitoring

• sudo apt-get install nginx• ls /etc/init.d/nginx• sudo service nginx restart

• sudo apt-get install mongodb-10gen• ls /etc/init.d/mongodb• sudo service mongodb status• ls /etc/mongodb.conf

• sudo apt-get install rabbitmq-server• ls /etc/init.d/rabbitmq-server• service rabbitmq-server status

Page 4: Linux processes control and monitoring

Monitoring system which just works

Page 5: Linux processes control and monitoring

• sudo apt-get install monit• ls /etc/init.d/monit• service monit status• cat sudo cat /etc/monit/monitrc

1. set daemon 120 # check services at 2-minute intervals2. set logfile /var/log/monit.log

1. check process nginx with pidfile /var/run/nginx.pid2. start program = "/etc/init.d/nginx start"3. stop program = "/etc/init.d/nginx stop"4. if failed port 80 protocol http then alert5. if cpu usage is greater than 60 percent for 2 cycles6. then alert7. if cpu usage > 98% for 5 cycles then restart8. if 2 restarts within 3 cycles then timeout9. alert [email protected]

Installation & Configuration

Page 6: Linux processes control and monitoring

Monit Web Server

Page 7: Linux processes control and monitoring

MongoDB process detail

Page 8: Linux processes control and monitoring

• /home/user/venv/bin/pip install tornado• ls venv/lib/python2.7/site-packages/tornado• venv/bin/python my_web_project/app.py

• /home/user/venv/bin/pip install celery• ls venv/lib/python2.7/site-packages/celery• venv/bin/celery worker -A myproject.tasks --

config=myproject.celeryconfig

Virtualev based Python stack

Page 9: Linux processes control and monitoring

A process control system

• supervisord• supervisorctl• Web Server• XML RPC Interface

• /home/user/venv/bin/pip install supervisor• ls venv/lib/python2.7/site-packages/supervisor• /venv/bin/echo_supervisord_conf > supervisord.conf• venv/bin/supervisord -c supervisord.conf• venv/bin/supervisorctl -c supervisord.conf shutdown

Page 10: Linux processes control and monitoring

Supervisor Web Interface

Page 11: Linux processes control and monitoring

Configuring Supervisor

Page 12: Linux processes control and monitoring

Celery supervisor config

Page 13: Linux processes control and monitoring

Plugin source code