{"id":15024292,"url":"https://github.com/bazzline/php_component_apache_status_parser","last_synced_at":"2025-10-03T22:31:12.929Z","repository":{"id":57025379,"uuid":"87984839","full_name":"bazzline/php_component_apache_status_parser","owner":"bazzline","description":"free as in freedom apache status parser","archived":true,"fork":false,"pushed_at":"2021-05-31T12:49:32.000Z","size":68,"stargazers_count":5,"open_issues_count":1,"forks_count":1,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-12-17T01:12:04.567Z","etag":null,"topics":["apache2","bazzline","builder","changelog","free-as-in-freedom","infrastructure","lgplv3","mod-status","parser","php","php56","php7","php71","psr","psr-4","serverstatus","status-parser","uri"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bazzline.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-11T22:27:34.000Z","updated_at":"2023-01-28T08:27:19.000Z","dependencies_parsed_at":"2022-08-23T16:20:32.286Z","dependency_job_id":null,"html_url":"https://github.com/bazzline/php_component_apache_status_parser","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazzline%2Fphp_component_apache_status_parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazzline%2Fphp_component_apache_status_parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazzline%2Fphp_component_apache_status_parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bazzline%2Fphp_component_apache_status_parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bazzline","download_url":"https://codeload.github.com/bazzline/php_component_apache_status_parser/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235198517,"owners_count":18951503,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apache2","bazzline","builder","changelog","free-as-in-freedom","infrastructure","lgplv3","mod-status","parser","php","php56","php7","php71","psr","psr-4","serverstatus","status-parser","uri"],"created_at":"2024-09-24T20:00:04.885Z","updated_at":"2025-10-03T22:31:07.648Z","avatar_url":"https://github.com/bazzline.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Full Stop\n\nI still like the idea but there is currently no use case to develop it anymore.\n\n# Apache Server Status Parser Component for PHP\n\nThis project aims to deliver an easy to use component to read the apache server status for a configured list of hosts and gain information about that.\n\nThis component is relying on the [apache mod_status](https://httpd.apache.org/docs/2.2/mod/mod_status.html) and the undocumented query \"[?notable](https://www.cyberciti.biz/faq/apache-server-status/)\" (\"?auto\" does not contain information about the pid).\n\nThe build status of the current master branch is tracked by Travis CI:\n[![Build Status](https://travis-ci.org/bazzline/php_component_apache_status_parser.png?branch=master)](http://travis-ci.org/bazzline/php_component_apache_status_parser)\n[![Latest stable](https://img.shields.io/packagist/v/net_bazzline/php_component_apache_server_status_parser.svg)](https://packagist.org/packages/net_bazzline/php_component_apache_server_status_parser)\n\nThe scrutinizer status is:\n[![code quality](https://scrutinizer-ci.com/g/bazzline/php_component_apache_status_parser/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/bazzline/php_component_apache_status_parser/)\n\nTake a look on [openhub.net](https://www.openhub.net/p/php_component_apache_status_parser).\n\nThe current change log can be found [here](https://github.com/bazzline/php_component_apache_status_parser/blob/master/CHANGELOG.md).\n\n# Project Goals\n\n* provides simple access to process information (deals with strings)\n* provides detailed access to all information (building a lot of objects)\n\n# Why?\n\nLet me give you an scenario I got on my desk and had to solve it.\n\n## Given\n\nAs a maintainer of an infrastructure with multiple apache HTTP servers, I need to know if a given process (identified by its pid, a infrastructure wide unique identifier and its uri) is still running or not.\nSometimes I know the IP Address of the server where process is running, mostly all I have is a pid, the unique identifier and the uri.\nAnd finally, it is allowed to use the apache server status but no ssh command execution.\n\n# How To Use\n\nBecause of the shipped with builders, it is really easy to getting started with.\nIf you want to use your application instance pooling, use the builders as manual how to plumper things together.\n\nThere are two different kind of builders, one (AbstractStorageBuilder) gives you the control over where to fetch and how much to fetch information.\nThe second one (ParserBuilder) simple uses the result from the first one to parse the information into domain objects.\n\n```php\n//If you want to parse the whole apache server status\n//  and create domain objects out of the information.\n\n//begin of dependencies\n$parserBuilderFactory       = new \\Net\\Bazzline\\Component\\ApacheServerStatusParser\\Service\\Builder\\ParserBuilderFactory();\n$storageBuilder             = new \\Net\\Bazzline\\Component\\ApacheServerStatusParser\\Service\\Builder\\RemoteStorageBuilder();\n\n$parserBuilder  = $parserBuilderFactory-\u003ecreate();\n//end of dependencies\n\n//begin of business logic\n//  the following five logical lines are doing the trick\n$storageBuilder-\u003esetUrlToTheApacheStatusFileToParseUpfront('\u003cthe url to your apache server status\u003e');\n$storageBuilder-\u003eselectParseModeAllUpfront();\n\n$storageBuilder-\u003ebuild();\n\n$parserBuilder-\u003esetStorageUpfront(\n    $storageBuilder-\u003eandGetStorageAfterTheBuild();\n);\n$parserBuilder-\u003ebuild();\n\n//  and now, do something with the result\nvar_dump(\n    $parserBuilder-\u003eandGetListOfDetailOrNullAfterwards()\n);\nvar_dump(\n    $parserBuilder-\u003eandGetInformationOrNullAfterwards()\n);\nvar_dump(\n    $parserBuilder-\u003eandGetScoreboardOrNullAfterwards()\n);\nvar_dump(\n    $parserBuilder-\u003eandGetStatisticOrNullAfterwards()\n);\n//end of business logic\n```\n\n# Example\n\nExamples are placed in the path [\u003cproject root\u003e/example](https://github.com/bazzline/php_component_apache_status_parser/tree/master/example). Because of the two implemented content fetchers, they are devide into the two categories \"[local](https://github.com/bazzline/php_component_apache_status_parser/tree/master/example/local)\" and \"[remote](https://github.com/bazzline/php_component_apache_status_parser/tree/master/example/remote)\".\n\n## Example Using Local File\n\n```\ncd \u003cproject root\u003e/example/local\n\n#if no file path is provided, the shipped with example file will be used\n#parse all\nphp parse_all.php [\u003cstring: path to the apache status file to parse\u003e]\n#parse detail only\nphp parse_detail_only.php [\u003cstring: path to the apache status file to parse\u003e]\n#check if a request is still running\nphp check_if_a_request_is_still_running \u003cint: pid\u003e [\u003cstring: uri path\u003e [\u003cstring: path to the example file\u003e]]\n```\n\n## Example Using Remote File\n\n```\ncd \u003cproject root\u003e/example/remote\n\n#if no file path is provided, the build in example url will be used\n#parse all\nphp remote/parse_all.php [\u003cstring: url to the apache status page\u003e]\n#parse detail only\nphp parse_detail_only.php [\u003cstring: url to the apache status page\u003e]\n```\n\n## Example Output\n\n### Parsed Detail\n\nJust one detail.\n\n```\nhttp_method: GET\nip_address: 198.76.54.42\npid: 22754\nstatus: Ready\nuri_authority: example.host.org:80\nuri_path_with_query: /\n```\n\n### Parsed Information\n\n```\ndate_of_built: Oct 06 1983 20:44:43\nidentifier: first.example.host.org (via 123.45.67.89)\nmode_of_mpm: prefork\nversion: Apache/2.4.10 (Debian)\n```\n\n### Parsed Scoreboard\n\n```\nprocess: _WWW_WWWWKW_....._.W..................................................................................................................................\nlegend\n    0: \"_\" Waiting for Connection,\n    1: \"S\" Starting up,\n    2: \"R\" Reading Request,\n    3: \"W\" Sending Reply,\n    4: \"K\" Keepalive (read),\n    5: \"D\" DNS Lookup,\n    6: \"C\" Closing connection,\n    7: \"L\" Logging,\n    8: \"G\" Gracefully finishing,\n    9: \"I\" Idle cleanup of worker,\n    10: \".\" Open slot with no current process\n```\n\n### Parsed Statistic\n\n```\nb_per_request: 1667\ncpu_load: 584\ncpu_usage: u959.08 s127.38 cu1.72 cs.95\ncurrent_timestamp: 1485804167\nidle_workers: 4\nkb_per_request: 57\nparent_server_configuration_generation: 1\nparent_server_mpm_generation: 1\nrequests_currently_being_processed: 10\nrequests_per_second: 283\nrestart_timestamp: 1485785532\nserver_load: 1.22 1.05 0.83\nserver_up_time: 5 hours 10 minutes 35 seconds\ntotal_accesses: 5279\ntotal_traffic: 29.6 MB\n```\n\n# Install\n\n## By Hand\n\n```\nmkdir -p vendor/net_bazzline/php_component_apache_server_status_parser\ncd vendor/net_bazzline/php_component_apache_server_status_parser\ngit clone https://github.com/bazzline/php_component_apache_server_status_parser .\n```\n\n## With [Packagist](https://packagist.org/packages/net_bazzline/php_component_apache_server_status_parser)\n\n```\ncomposer require net_bazzline/php_component_apache_server_status_parser:dev-master\n```\n\n# Workflow\n\n* get content\n* split content into dedicated sections\n    * detail\n    * information\n    * scoreboard\n    * statistic\n* parse each section into its fitting domain object\n\n# List Of Domain Model\n\n* DomainModel\\Detail\n    * dynamic detail information about each worker\n* DomainModel\\Information\n    * general static information about the environment\n* DomainModel\\Scoreboard\n    * dynamic and general worker information\n* DomainModel\\Statistic\n    * dynamic server statistic\n\n# List Of Service\n\n* Service\\Builder\n    * contains builder classes to kickstart the usage of this component\n* Service\\Content\\Fetcher\n    * contains classes to get the apache status content from somewhere\n* Service\\Content\\Parser\n    * contains classes to create domain objects out of the content\n* Service\\Content\\Processor\n    * contains the class to split the content into logical parts (does the heavy lifting)\n* Service\\Content\\Storage\n    * contains classes to share the logical content parts\n* Service\\StateMachine\n    * contains a class to ease up splitting the content into logical parts\n\n# Notes\n\nThanks to:\n* [mod_status_parser](https://github.com/nikos-glikis/mod_status_parser)\n* [determine if an apache process is still running](http://artodeto.bazzline.net/archives/846-determine-if-an-apache-process-is-still-running-via-bash-to-prevent-multiple-instances-running.html)\n* [apache for the cloud](http://people.apache.org/~jim/presos/ACNA11/Apache_httpd_cloud.pdf)\n* [reading apache server status](https://answers.splunk.com/answers/28058/reading-apache-server-status-output.html)\n* [Apache Server Status](https://www.phpclasses.org/browse/file/17516.html)\n\n# Final Words\n\nStar it if you like it :-). Add issues if you need it. Pull patches if you enjoy it. Write a blog entry if you use it. [Donate something](https://gratipay.com/~stevleibelt) if you love it :-].\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazzline%2Fphp_component_apache_status_parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbazzline%2Fphp_component_apache_status_parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbazzline%2Fphp_component_apache_status_parser/lists"}