mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
hopefully doesn't break anything Mostly issues with snmp oids and options containing spaces. Try to remove all of those. DO NOT DELETE THIS TEXT #### Please note > Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting. - [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/) #### Testers If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926` After you are done testing, you can remove the changes with `./scripts/github-remove`. If there are schema changes, you can ask on discord how to revert.
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
use LibreNMS\RRD\RrdDefinition;
|
|
|
|
$name = 'php-fpm';
|
|
$app_id = $app['app_id'];
|
|
|
|
$options = '-Oqv';
|
|
$oid = '.1.3.6.1.4.1.8072.1.3.2.3.1.2.8.112.104.112.102.112.109.115.112';
|
|
$phpfpm = snmp_walk($device, $oid, $options);
|
|
|
|
list($pool,$start_time,$start_since,$accepted_conn,$listen_queue,$max_listen_queue,$listen_queue_len,$idle_processes,
|
|
$active_processes,$total_processes,$max_active_processes,$max_children_reached,$slow_requests) = explode("\n", $phpfpm);
|
|
|
|
$rrd_name = array('app', $name, $app_id);
|
|
$rrd_def = RrdDefinition::make()
|
|
->addDataset('lq', 'GAUGE', 0)
|
|
->addDataset('mlq', 'GAUGE', 0)
|
|
->addDataset('ip', 'GAUGE', 0)
|
|
->addDataset('ap', 'GAUGE', 0)
|
|
->addDataset('tp', 'GAUGE', 0)
|
|
->addDataset('map', 'GAUGE', 0)
|
|
->addDataset('mcr', 'GAUGE', 0)
|
|
->addDataset('sr', 'GAUGE', 0);
|
|
|
|
$fields = array(
|
|
'lq' => $listen_queue,
|
|
'mlq' => $max_listen_queue,
|
|
'ip' => $idle_processes,
|
|
'ap' => $active_processes,
|
|
'tp' => $total_processes,
|
|
'map' => $max_active_processes,
|
|
'mcr' => $max_children_reached,
|
|
'sr' => $slow_requests
|
|
);
|
|
|
|
$tags = array('name' => $name, 'app_id' => $app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name);
|
|
data_update($device, 'app', $tags, $fields);
|
|
update_application($app, $phpfpm, $fields);
|