PERL   18

apachehits

Guest on 23rd September 2022 12:48:30 AM

  1. #!/usr/bin/perl
  2.  
  3. # Script to get the requests per second and the requests currently being processed from
  4. # an Apache webserver.
  5.  
  6. # In order for this to work, you will need to have server stats enabled in Apache.
  7. # To enable the builtin apache server-status, you will need to enable mod_status
  8. # and have something like the following in your httpd.conf file.
  9. # ExtendedStatus        on
  10. # <Location /server-status>
  11. #     SetHandler server-status
  12. #     Order deny,allow
  13. #     Deny from all
  14. #     Allow from localhost
  15. # </Location>
  16.  
  17.  
  18. $output = `/bin/bash -c 'wget --quiet -O - \"http:\/\/localhost\/server-status"'`;
  19. $output =~ /(.*) requests\/sec/;
  20. print $1." ";
  21. $output =~ /(.*) requests currently being processed/;
  22. print $1;

Raw Paste


Login or Register to edit or fork this paste. It's free.