We are in the process of migrating this forum. A new space will be available soon. We are sorry for the inconvenience.

PHP exec() monitoring processes


claudioder
16-06-2015, 09:37
Thanks for your reply.
Unfortunately, shell_exec doesn't work either. It returns NULL (confirming an error status).
MEanwhile i'll take a look at Nagios/Zabbix solution

alvaroag
15-06-2015, 15:54
If you are using "exec", that may be the problem. According to PHP docs, exec returns only the last line of the command output. Try with shell_exec instead.

BTW, if you want to monitor such parameters(and more) I'd recommend to use a more complete monitoring solution like Nagios or Zabbix(I'm currently using this), which will allow you to monitor a full set of servers and services with alerts and more.

claudioder
15-06-2015, 13:17
Hi,
I have a website that allow me to monitoring various parameters about the hosting server.
I used the php function exec() to retrieve data about:
- server uptime
- storage available
- monitoring process

My script was tested in a test server, and all commands works well.
In my VPS, the commands storage (df -h) and server uptime (uptime) works well, but any command related to retrieve process (es: pidof command, pgrep command, also ps aux | grep command) doesn't work. $output variable is empty, $return variable returns 1.
I don't know if these commands are blocked by OVH itself or if this situation is caused by some config file.
I have found no answers today on. Any suggestions?