HEX
Server: Apache/2.4.67 (Debian)
System: Linux hosting103 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User: muzikaecom (1013)
PHP: 8.3.31
Disabled: NONE
Upload Files
File: //usr/local/sbin/hp-monitor
#!/usr/bin/env php
<?php

function fmt($domain, $count) {
	$domain_width = 30;
        $count_width  = 10;

	$len = $domain_width + $count_width - strlen($domain) - strlen($count);
	if ($len < 1) $len = 1;

	print $domain;
	print str_repeat(' ', $len);
	print $count;
	print "\n";
}

$file = "/tmp/hp-monitord.sock";

$client = @socket_create(AF_UNIX, SOCK_STREAM, 0) or die ("Cannot create socket!");
@socket_connect($client, $file) or die ("Cannot connect socket! Is hp-monitord running?");

$buffer = "";

while (($buf = socket_read($client, 1024)) != "")
	$buffer .= $buf;

$data = json_decode($buffer, true);

foreach ($data as $domain => $count) {
	fmt($domain, $count);
}