Skip to content

Instantly share code, notes, and snippets.

@nhalstead
Created August 24, 2018 16:12
Show Gist options
  • Save nhalstead/f558dd9193dc467478dc3994c61ab180 to your computer and use it in GitHub Desktop.
Save nhalstead/f558dd9193dc467478dc3994c61ab180 to your computer and use it in GitHub Desktop.
NGINX Status Page Parse
<?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