Created
August 24, 2018 16:12
-
-
Save nhalstead/f558dd9193dc467478dc3994c61ab180 to your computer and use it in GitHub Desktop.
NGINX Status Page Parse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$NGINXStat = <<<EOF | |
Active connections: 32 | |
server accepts handled requests | |
48932 48932 2594381 | |
Reading: 2 Writing: 8 Waiting: 30 | |
EOF; | |
$lines = explode("\n",$NGINXStat); | |
$srvAccUn = explode(" ", $lines[0]); | |
$srvAcc["active"] = $srvAccUn[2]; | |
$srvAccUn = explode(" ", $lines[2]); | |
$srvAcc["accepts"] = $srvAccUn[0]; | |
$srvAcc["handled"] = $srvAccUn[2]; | |
$srvAccUn = explode(" ", $lines[3]); | |
$srvAcc["reading"] = $srvAccUn[1]; | |
$srvAcc["writing"] = $srvAccUn[3]; | |
$srvAcc["waiting"] = $srvAccUn[5]; | |
print_r($srvAcc); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment