Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #!/usr/bin/env python
  2. from fabric.api import run, env, sudo
  3. net_part = '192.168.1.'
  4. env.hosts = [net_part + str(i) for i in range(1, 255)]
  5. env.user = 'administrator'
  6. env.password = 'password'
  7.  
  8. def host_type():
  9.     try:
  10.         type_host = run('uname -s')
  11.         if type_host == 'Linux':
  12.             check_apache()
  13.     except:
  14.         pass
  15. def check_apache():
  16.     run('ps -e -O rss,pcpu |grep apache')
  17.  
  18. def test_memory():
  19.     run('free -m')
  20.  
  21. def update():
  22.     sudo('apt-get update')
  23.  
  24. if __name__ == '__main__':
  25.     host_type()
  26.     check_apache()
  27.     test_memory()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement