OVH Community, your new community space.

PHP exec() monitoring processes

16-06-2015, 08: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

15-06-2015, 14: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.

15-06-2015, 12:17
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?