daily
rotate 2
}
+
+### Zabbix
+
+To monitor the health status of your Friendica installation, you can use for example a tool like Zabbix. Please define 'stats_key' in your local.config.php in the 'system' section to be able to access the statistics page at /stats?key=your-defined-stats_key
+
+The statistics contain data about the worker performance, the last cron call, number of reports, inbound and outbound packets, posts and comments.
Logger::warning('Post does not exist although it was supposed to had been fetched.', ['id' => $id, 'url' => $url, 'uid' => $uid]);
return 0;
}
+
+ public static function incrementInbound(string $network)
+ {
+ $packets = DI::keyValue()->get('stats_packets_inbound_' . $network) ?? 0;
+ if ($packets >= PHP_INT_MAX) {
+ $packets = 0;
+ }
+ DI::keyValue()->set('stats_packets_inbound_' . $network, $packets + 1);
+ }
+
+ public static function incrementOutbound(string $network)
+ {
+ $packets = DI::keyValue()->get('stats_packets_outbound_' . $network) ?? 0;
+ if ($packets >= PHP_INT_MAX) {
+ $packets = 0;
+ }
+ DI::keyValue()->set('stats_packets_outbound_' . $network, $packets + 1);
+ }
}
namespace Friendica\Module\ActivityPub;
use Friendica\Core\Logger;
+use Friendica\Core\Protocol;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI;
+use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Module\BaseApi;
use Friendica\Module\Special\HTTPException;
$uid = 0;
}
+ Item::incrementInbound(Protocol::ACTIVITYPUB);
ActivityPub\Receiver::processInbox($postdata, $_SERVER, $uid);
throw new \Friendica\Network\HTTPException\AcceptedException();
namespace Friendica\Module\DFRN;
use Friendica\BaseModule;
+use Friendica\Core\Protocol;
use Friendica\Model\Contact;
use Friendica\Model\Conversation;
+use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Module\Response;
use Friendica\Network\HTTPException;
throw new HTTPException\BadRequestException();
}
+ Item::incrementInbound(Protocol::DFRN);
+
$data = json_decode($postdata);
if (is_object($data) && !empty($this->parameters['nickname'])) {
$user = User::getByNickname($this->parameters['nickname']);
use Friendica\BaseModule;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
+use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Module\Response;
use Friendica\Network\HTTPException;
throw new HTTPException\ForbiddenException($this->t('Access denied.'));
}
+ Item::incrementInbound(Protocol::DIASPORA);
+
if ($this->parameters['type'] === 'public') {
$this->receivePublic();
} else if ($this->parameters['type'] === 'users') {
use Friendica\Database\Database;
use Friendica\Model\Contact;
use Friendica\Model\GServer;
+use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Module\Response;
use Friendica\Network\HTTPException;
$this->logger->info('Import item from Contact.', ['nickname' => $nickname, 'contact-nickname' => $contact['nick'], 'contact-id' => $contact['id']]);
$feedhub = '';
+ Item::incrementOutbound(Protocol::OSTATUS);
OStatus::import($xml, $importer, $contact, $feedhub);
throw new HTTPException\OKException();
use Friendica\Core\Protocol;
use Friendica\Database\Database;
use Friendica\Model\GServer;
+use Friendica\Model\Item;
use Friendica\Model\Post;
use Friendica\Module\Response;
use Friendica\Protocol\ActivityNamespace;
$contact = $contact ?: [];
+ Item::incrementOutbound(Protocol::OSTATUS);
OStatus::import($data, $importer, $contact, $hub);
throw new HTTPException\OKException();
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\KeyValueStorage\Capability\IManageKeyValuePairs;
use Friendica\Core\L10n;
+use Friendica\Core\Protocol;
use Friendica\Core\Worker;
use Friendica\Database\Database;
use Friendica\Model\Register;
'comments' => intval($this->keyValue->get('nodeinfo_local_comments')),
],
],
+ 'packets' => [
+ 'inbound' => [
+ Protocol::ACTIVITYPUB => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::ACTIVITYPUB) ?? 0),
+ Protocol::DFRN => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::DFRN) ?? 0),
+ Protocol::DIASPORA => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::DIASPORA) ?? 0),
+ Protocol::OSTATUS => intval($this->keyValue->get('stats_packets_inbound_' . Protocol::OSTATUS) ?? 0),
+ ],
+ 'outbound' => [
+ Protocol::ACTIVITYPUB => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::ACTIVITYPUB) ?? 0),
+ Protocol::DFRN => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::DFRN) ?? 0),
+ Protocol::DIASPORA => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::DIASPORA) ?? 0),
+ Protocol::OSTATUS => intval($this->keyValue->get('stats_packets_outbound_' . Protocol::OSTATUS) ?? 0),
+ ]
+ ],
'reports' => [
'newest' => [
'datetime' => $report_datetime,
$content_type = ($public_batch ? 'application/magic-envelope+xml' : 'application/json');
$postResult = DI::httpClient()->post($dest_url, $envelope, ['Content-Type' => $content_type], 0, HttpClientRequest::DFRN);
+ Item::incrementOutbound(Protocol::DFRN);
$xml = $postResult->getBodyString();
$curl_stat = $postResult->getReturnCode();
$postResult = DI::httpClient()->post($dest_url . '/', $envelope, ['Content-Type' => $content_type], 0, HttpClientRequest::DIASPORA);
$return_code = $postResult->getReturnCode();
+ Item::incrementOutbound(Protocol::DIASPORA);
} else {
Logger::notice('test_mode');
return 200;
namespace Friendica\Protocol;
use Friendica\Core\Logger;
+use Friendica\Core\Protocol;
use Friendica\DI;
+use Friendica\Model\Item;
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
use Friendica\Network\Probe;
$return_code = $postResult->getReturnCode();
}
+ Item::incrementOutbound(Protocol::OSTATUS);
Logger::info('slapper for ' . $url . ' returned ' . $return_code);
if (!$return_code) {
use Friendica\Model\APContact;
use Friendica\Model\Contact;
use Friendica\Model\GServer;
+use Friendica\Model\Item;
use Friendica\Model\ItemURI;
use Friendica\Model\User;
use Friendica\Network\HTTPClient\Capability\ICanHandleHttpResponses;
self::setInboxStatus($target, ($return_code >= 200) && ($return_code <= 299));
+ Item::incrementOutbound(Protocol::ACTIVITYPUB);
+
return $postResult;
}
$delivery_queue_count++;
Salmon::slapper($owner, $url, $slap);
+ Item::incrementOutbound(Protocol::OSTATUS);
Post\DeliveryData::incrementQueueDone($target_item['uri-id'], Post\DeliveryData::OSTATUS);
}
}