diff --git a/doc/Extensions/Applications.md b/doc/Extensions/Applications.md index 931a5c9512..9a63044681 100644 --- a/doc/Extensions/Applications.md +++ b/doc/Extensions/Applications.md @@ -2042,6 +2042,50 @@ systemctl reload snmpd 7. You're now ready to enable the application in LibreNMS. +## Privoxy + +For this to work, the following log items need enabled for Privoxy. + +``` +debug 2 # show each connection status +debug 512 # Common Log Format +debug 1024 # Log the destination for requests Privoxy didn't let through, and the reason why. +debug 4096 # Startup banner and warnings +debug 8192 # Non-fatal errors +``` + +### SNMP Extend + +1. Download the extend and make sure it is executable. +``` +wget https://github.com/librenms/librenms-agent/raw/master/snmp/privoxy -O /etc/snmp/privoxy +chmod +x /etc/snmp/privoxy +``` + +2. Install the depdenencies. +``` +# FreeBSD +pkg install p5-File-ReadBackwards p5-Time-Piece p5-JSON p5-IPC-Run3 p5-Gzip-Faster p5-MIME-Base64 +# Debian +apt-get install cpanminus zlib1g +cpanm File::ReadBackwards Time::Piece JSON IPC::Run3 MIME::Base64 Gzip::Faster +``` + +3. Add the extend to snmpd.conf and restart snmpd. +``` +extend privoxy /etc/snmp/privoxy +``` + +If your logfile is not at `/var/log/privoxy/logfile`, that may be +changed via the `-f` option. + +If `privoxy-log-parser.pl` is not found in your standard `$PATH` +setting, you may will need up call the extend via `/usr/bin/env` with +a `$PATH` set to something that includes it. + +Once that is done, just wait for the server to be rediscovered or just +enable it manually. + ## Pwrstatd Pwrstatd (commonly known as powerpanel) is an application/service available from CyberPower to monitor their PSUs over USB. It is currently capable of reading the status of only one PSU connected via USB at a time. The powerpanel software is available here: diff --git a/includes/html/graphs/application/privoxy_block_percent.inc.php b/includes/html/graphs/application/privoxy_block_percent.inc.php new file mode 100644 index 0000000000..fbaf6718cb --- /dev/null +++ b/includes/html/graphs/application/privoxy_block_percent.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_blocks.inc.php b/includes/html/graphs/application/privoxy_blocks.inc.php new file mode 100644 index 0000000000..f02f2c3964 --- /dev/null +++ b/includes/html/graphs/application/privoxy_blocks.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_bytes_to_client.inc.php b/includes/html/graphs/application/privoxy_bytes_to_client.inc.php new file mode 100644 index 0000000000..40d217b9a0 --- /dev/null +++ b/includes/html/graphs/application/privoxy_bytes_to_client.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_client_cons.inc.php b/includes/html/graphs/application/privoxy_client_cons.inc.php new file mode 100644 index 0000000000..3de26d817d --- /dev/null +++ b/includes/html/graphs/application/privoxy_client_cons.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_client_requests.inc.php b/includes/html/graphs/application/privoxy_client_requests.inc.php new file mode 100644 index 0000000000..18d54a2fbb --- /dev/null +++ b/includes/html/graphs/application/privoxy_client_requests.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_con_failures.inc.php b/includes/html/graphs/application/privoxy_con_failures.inc.php new file mode 100644 index 0000000000..2c6aa1d086 --- /dev/null +++ b/includes/html/graphs/application/privoxy_con_failures.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_con_timeouts.inc.php b/includes/html/graphs/application/privoxy_con_timeouts.inc.php new file mode 100644 index 0000000000..369c373853 --- /dev/null +++ b/includes/html/graphs/application/privoxy_con_timeouts.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_crunches.inc.php b/includes/html/graphs/application/privoxy_crunches.inc.php new file mode 100644 index 0000000000..8b3e75af83 --- /dev/null +++ b/includes/html/graphs/application/privoxy_crunches.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_empty_resps.inc.php b/includes/html/graphs/application/privoxy_empty_resps.inc.php new file mode 100644 index 0000000000..b90e13a0d3 --- /dev/null +++ b/includes/html/graphs/application/privoxy_empty_resps.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_empty_resps_new.inc.php b/includes/html/graphs/application/privoxy_empty_resps_new.inc.php new file mode 100644 index 0000000000..f5d842e295 --- /dev/null +++ b/includes/html/graphs/application/privoxy_empty_resps_new.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_empty_resps_reuse.inc.php b/includes/html/graphs/application/privoxy_empty_resps_reuse.inc.php new file mode 100644 index 0000000000..0b6637b6e2 --- /dev/null +++ b/includes/html/graphs/application/privoxy_empty_resps_reuse.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_fast_redirs.inc.php b/includes/html/graphs/application/privoxy_fast_redirs.inc.php new file mode 100644 index 0000000000..60cb53659b --- /dev/null +++ b/includes/html/graphs/application/privoxy_fast_redirs.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_imp_accounted.inc.php b/includes/html/graphs/application/privoxy_imp_accounted.inc.php new file mode 100644 index 0000000000..d0df0e5619 --- /dev/null +++ b/includes/html/graphs/application/privoxy_imp_accounted.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_max_reqs.inc.php b/includes/html/graphs/application/privoxy_max_reqs.inc.php new file mode 100644 index 0000000000..05640cdde6 --- /dev/null +++ b/includes/html/graphs/application/privoxy_max_reqs.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_nog_conns.inc.php b/includes/html/graphs/application/privoxy_nog_conns.inc.php new file mode 100644 index 0000000000..39a31897ff --- /dev/null +++ b/includes/html/graphs/application/privoxy_nog_conns.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_out_requests.inc.php b/includes/html/graphs/application/privoxy_out_requests.inc.php new file mode 100644 index 0000000000..3ae3220539 --- /dev/null +++ b/includes/html/graphs/application/privoxy_out_requests.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req.inc.php b/includes/html/graphs/application/privoxy_req.inc.php new file mode 100644 index 0000000000..0e3e007398 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req.inc.php @@ -0,0 +1,64 @@ +app_id]); + +$rrd_list = []; +if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'CONNECT', + 'ds' => 'req_connect', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'DELETE', + 'ds' => 'req_delete', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'GET', + 'ds' => 'req_get', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'HEAD', + 'ds' => 'req_head', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'OPTIONS', + 'ds' => 'req_options', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'PATCH', + 'ds' => 'req_patch', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'POST', + 'ds' => 'req_post', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'PUT', + 'ds' => 'req_put', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => 'TRACE', + 'ds' => 'req_trace', + ]; +} else { + d_echo('RRD "' . $rrd_filename . '" not found'); +} + +require 'includes/html/graphs/generic_multi_line.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_connect.inc.php b/includes/html/graphs/application/privoxy_req_connect.inc.php new file mode 100644 index 0000000000..dba0534075 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_connect.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_delete.inc.php b/includes/html/graphs/application/privoxy_req_delete.inc.php new file mode 100644 index 0000000000..161c114a0d --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_delete.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_get.inc.php b/includes/html/graphs/application/privoxy_req_get.inc.php new file mode 100644 index 0000000000..bb4d9d8c19 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_get.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_head.inc.php b/includes/html/graphs/application/privoxy_req_head.inc.php new file mode 100644 index 0000000000..67629d5cf1 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_head.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_options.inc.php b/includes/html/graphs/application/privoxy_req_options.inc.php new file mode 100644 index 0000000000..992b41219e --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_options.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_patch.inc.php b/includes/html/graphs/application/privoxy_req_patch.inc.php new file mode 100644 index 0000000000..b355100885 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_patch.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_post.inc.php b/includes/html/graphs/application/privoxy_req_post.inc.php new file mode 100644 index 0000000000..18dcfc0e78 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_post.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_put.inc.php b/includes/html/graphs/application/privoxy_req_put.inc.php new file mode 100644 index 0000000000..d15d2e5cd4 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_put.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_req_trace.inc.php b/includes/html/graphs/application/privoxy_req_trace.inc.php new file mode 100644 index 0000000000..097ffc4127 --- /dev/null +++ b/includes/html/graphs/application/privoxy_req_trace.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_1xx.inc.php b/includes/html/graphs/application/privoxy_resp_1xx.inc.php new file mode 100644 index 0000000000..334d487a74 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_1xx.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_200.inc.php b/includes/html/graphs/application/privoxy_resp_200.inc.php new file mode 100644 index 0000000000..4f63c2e49d --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_200.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_2xx.inc.php b/includes/html/graphs/application/privoxy_resp_2xx.inc.php new file mode 100644 index 0000000000..d34f3fc0ac --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_2xx.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_2xx_other.inc.php b/includes/html/graphs/application/privoxy_resp_2xx_other.inc.php new file mode 100644 index 0000000000..2032b1dcc2 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_2xx_other.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_301.inc.php b/includes/html/graphs/application/privoxy_resp_301.inc.php new file mode 100644 index 0000000000..b32bb85cf9 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_301.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_302.inc.php b/includes/html/graphs/application/privoxy_resp_302.inc.php new file mode 100644 index 0000000000..7270b7fd42 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_302.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_303.inc.php b/includes/html/graphs/application/privoxy_resp_303.inc.php new file mode 100644 index 0000000000..59aa0b96d8 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_303.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_3xx.inc.php b/includes/html/graphs/application/privoxy_resp_3xx.inc.php new file mode 100644 index 0000000000..4fba038c64 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_3xx.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_3xx_other.inc.php b/includes/html/graphs/application/privoxy_resp_3xx_other.inc.php new file mode 100644 index 0000000000..4b47898db8 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_3xx_other.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_403.inc.php b/includes/html/graphs/application/privoxy_resp_403.inc.php new file mode 100644 index 0000000000..24a42c96e1 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_403.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_404.inc.php b/includes/html/graphs/application/privoxy_resp_404.inc.php new file mode 100644 index 0000000000..210466c070 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_404.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_451.inc.php b/includes/html/graphs/application/privoxy_resp_451.inc.php new file mode 100644 index 0000000000..3517003d5b --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_451.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_4xx.inc.php b/includes/html/graphs/application/privoxy_resp_4xx.inc.php new file mode 100644 index 0000000000..031e780b17 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_4xx.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_4xx_other.inc.php b/includes/html/graphs/application/privoxy_resp_4xx_other.inc.php new file mode 100644 index 0000000000..39594c4451 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_4xx_other.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_500.inc.php b/includes/html/graphs/application/privoxy_resp_500.inc.php new file mode 100644 index 0000000000..609e3f3d01 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_500.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_502.inc.php b/includes/html/graphs/application/privoxy_resp_502.inc.php new file mode 100644 index 0000000000..fe568efeac --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_502.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_503.inc.php b/includes/html/graphs/application/privoxy_resp_503.inc.php new file mode 100644 index 0000000000..d67fe49f17 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_503.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_504.inc.php b/includes/html/graphs/application/privoxy_resp_504.inc.php new file mode 100644 index 0000000000..afd8cf8f89 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_504.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_5xx.inc.php b/includes/html/graphs/application/privoxy_resp_5xx.inc.php new file mode 100644 index 0000000000..9342427672 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_5xx.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_5xx_other.inc.php b/includes/html/graphs/application/privoxy_resp_5xx_other.inc.php new file mode 100644 index 0000000000..9c888a2a1d --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_5xx_other.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_resp_xxx.inc.php b/includes/html/graphs/application/privoxy_resp_xxx.inc.php new file mode 100644 index 0000000000..519f8138c2 --- /dev/null +++ b/includes/html/graphs/application/privoxy_resp_xxx.inc.php @@ -0,0 +1,44 @@ +app_id]); + +$rrd_list = []; +if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '1xx', + 'ds' => 'resp_1xx', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '2xx', + 'ds' => 'resp_2xx', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '3xx', + 'ds' => 'resp_3xx', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '4xx', + 'ds' => 'resp_4xx', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '5xx', + 'ds' => 'resp_5xx', + ]; +} else { + d_echo('RRD "' . $rrd_filename . '" not found'); +} + +require 'includes/html/graphs/generic_multi_line.inc.php'; diff --git a/includes/html/graphs/application/privoxy_reused_server_cons.inc.php b/includes/html/graphs/application/privoxy_reused_server_cons.inc.php new file mode 100644 index 0000000000..c4268220d5 --- /dev/null +++ b/includes/html/graphs/application/privoxy_reused_server_cons.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ska_offers.inc.php b/includes/html/graphs/application/privoxy_ska_offers.inc.php new file mode 100644 index 0000000000..48fa237006 --- /dev/null +++ b/includes/html/graphs/application/privoxy_ska_offers.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ubd_np_per.inc.php b/includes/html/graphs/application/privoxy_ubd_np_per.inc.php new file mode 100644 index 0000000000..b48c683ccb --- /dev/null +++ b/includes/html/graphs/application/privoxy_ubd_np_per.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ubd_per.inc.php b/includes/html/graphs/application/privoxy_ubd_per.inc.php new file mode 100644 index 0000000000..9142653057 --- /dev/null +++ b/includes/html/graphs/application/privoxy_ubd_per.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_unique_bdomains.inc.php b/includes/html/graphs/application/privoxy_unique_bdomains.inc.php new file mode 100644 index 0000000000..5b3447d5dc --- /dev/null +++ b/includes/html/graphs/application/privoxy_unique_bdomains.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_unique_bdomains_np.inc.php b/includes/html/graphs/application/privoxy_unique_bdomains_np.inc.php new file mode 100644 index 0000000000..001551113d --- /dev/null +++ b/includes/html/graphs/application/privoxy_unique_bdomains_np.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_unique_domains.inc.php b/includes/html/graphs/application/privoxy_unique_domains.inc.php new file mode 100644 index 0000000000..dacf3708e2 --- /dev/null +++ b/includes/html/graphs/application/privoxy_unique_domains.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_unique_domains_np.inc.php b/includes/html/graphs/application/privoxy_unique_domains_np.inc.php new file mode 100644 index 0000000000..01aa555a14 --- /dev/null +++ b/includes/html/graphs/application/privoxy_unique_domains_np.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ver.inc.php b/includes/html/graphs/application/privoxy_ver.inc.php new file mode 100644 index 0000000000..7670064aaa --- /dev/null +++ b/includes/html/graphs/application/privoxy_ver.inc.php @@ -0,0 +1,39 @@ +app_id]); + +$rrd_list = []; +if (Rrd::checkRrdExists($rrd_filename)) { + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '1.0', + 'ds' => 'ver_1_0', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '1.1', + 'ds' => 'ver_1_1', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '2', + 'ds' => 'ver_2', + ]; + $rrd_list[] = [ + 'filename' => $rrd_filename, + 'descr' => '3', + 'ds' => 'ver_3', + ]; +} else { + d_echo('RRD "' . $rrd_filename . '" not found'); +} + +require 'includes/html/graphs/generic_multi_line.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ver_1_0.inc.php b/includes/html/graphs/application/privoxy_ver_1_0.inc.php new file mode 100644 index 0000000000..eb8ed6be9b --- /dev/null +++ b/includes/html/graphs/application/privoxy_ver_1_0.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ver_1_1.inc.php b/includes/html/graphs/application/privoxy_ver_1_1.inc.php new file mode 100644 index 0000000000..99ac273fdb --- /dev/null +++ b/includes/html/graphs/application/privoxy_ver_1_1.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ver_2.inc.php b/includes/html/graphs/application/privoxy_ver_2.inc.php new file mode 100644 index 0000000000..0884f7c4ab --- /dev/null +++ b/includes/html/graphs/application/privoxy_ver_2.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/graphs/application/privoxy_ver_3.inc.php b/includes/html/graphs/application/privoxy_ver_3.inc.php new file mode 100644 index 0000000000..7fb3953f1c --- /dev/null +++ b/includes/html/graphs/application/privoxy_ver_3.inc.php @@ -0,0 +1,13 @@ +app_type, $app->app_id]); + +if (! Rrd::checkRrdExists($filename)) { + d_echo('RRD "' . $filename . '" not found'); +} + +require 'includes/html/graphs/generic_stats.inc.php'; diff --git a/includes/html/pages/apps.inc.php b/includes/html/pages/apps.inc.php index af2195d504..8f9ff3ec4f 100644 --- a/includes/html/pages/apps.inc.php +++ b/includes/html/pages/apps.inc.php @@ -470,6 +470,16 @@ $graphs['linux_softnet_stat'] = [ 'received_rps', 'budget', ]; +$graphs['privoxy'] = [ + 'client_requests', + 'blocks', + 'crunches', + 'unique_bdomains', + 'bytes_to_client', + 'req', + 'resp_xxx', + 'ver', +]; echo '
'; echo '
'; diff --git a/includes/html/pages/device/apps/privoxy.inc.php b/includes/html/pages/device/apps/privoxy.inc.php new file mode 100644 index 0000000000..a87f9e5747 --- /dev/null +++ b/includes/html/pages/device/apps/privoxy.inc.php @@ -0,0 +1,163 @@ +'privoxy', 'privoxyPage'=>'general']); +if ($vars['privoxyPage'] == 'general') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp . ' | '; + +$link_tmp = generate_link('Blocks', $link_array, ['app'=>'privoxy', 'privoxyPage'=>'blocks']); +if ($vars['privoxyPage'] == 'blocks') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp . ' | '; + +$link_tmp = generate_link('Connections', $link_array, ['app'=>'privoxy', 'privoxyPage'=>'conn']); +if ($vars['privoxyPage'] == 'conn') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp . ' | '; + +$link_tmp = generate_link('Domains', $link_array, ['app'=>'privoxy', 'privoxyPage'=>'domains']); +if ($vars['privoxyPage'] == 'domains') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp . ' | '; + +$link_tmp = generate_link('HTTP Req Type', $link_array, ['app'=>'privoxy', 'privoxyPage'=>'http_type']); +if ($vars['privoxyPage'] == 'http_type') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp . ' | '; + +$link_tmp = generate_link('HTTP Response Codes', $link_array, ['app'=>'privoxy', 'privoxyPage'=>'http_resp']); +if ($vars['privoxyPage'] == 'http_resp') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp . ' | '; + +$link_tmp = generate_link('HTTP Version', $link_array, ['app'=>'privoxy', 'privoxyPage'=>'http_ver']); +if ($vars['privoxyPage'] == 'http_ver') { + $link_tmp = '' . $link_tmp . ''; +} +echo $link_tmp; + +print_optionbar_end(); + +if ($vars['privoxyPage'] == 'general') { + $graphs = [ + 'privoxy_client_requests' => 'Client Requests', + 'privoxy_blocks' => 'Blocked Requests', + 'privoxy_block_percent' => 'Blocked Requests, Percent', + 'privoxy_crunches'=>'Crunches', + 'privoxy_unique_domains'=>'Unique Domains', + 'privoxy_unique_bdomains'=>'Unique Domains Blocked', + 'privoxy_ubd_per'=>'Unique Domains Blocked, Percent', + 'privoxy_bytes_to_client' => 'Bytes Sent To Clients', + 'privoxy_imp_accounted' => 'Improperly Accounted', + ]; +} elseif ($vars['privoxyPage'] == 'conn') { + $graphs = [ + 'privoxy_nog_conns' => 'New Outgoing Requests', + 'privoxy_reused_server_cons' => 'Reused Server Connections', + 'privoxy_max_reqs' => 'Max Requests Per TCP Session', + 'privoxy_out_requests' => 'Out Going Requests', + 'privoxy_bytes_to_client' => 'Bytes To Client', + ]; +} elseif ($vars['privoxyPage'] == 'blocks') { + $graphs = [ + 'privoxy_blocks' => 'Blocked Requests', + 'privoxy_block_percent' => 'Blocked Requests, Percent', + 'privoxy_crunches'=>'Crunches', + 'privoxy_unique_bdomains' => 'Unique Domains, Blocked', + 'privoxy_unique_bdomains_np' => 'Unique Domains Without Port, Blocked', + ]; +} elseif ($vars['privoxyPage'] == 'http_ver') { + $graphs = [ + 'privoxy_ver' => 'HTTP Versions', + 'privoxy_ver_1_0' => 'HTTP/1.0', + 'privoxy_ver_1_1' => 'HTTP/1.1', + 'privoxy_ver_2' => 'HTTP/2', + 'privoxy_ver_3' => 'HTTP/3', + ]; +} elseif ($vars['privoxyPage'] == 'http_type') { + $graphs = [ + 'privoxy_req' => 'HTTP Request Types', + 'privoxy_req_connect' => 'CONNECT', + 'privoxy_req_delete' => 'DELETE', + 'privoxy_req_get' => 'GET', + 'privoxy_req_head' => 'HEAD', + 'privoxy_req_options' => 'OPTIONS', + 'privoxy_req_patch' => 'PATCH', + 'privoxy_req_post' => 'POST', + 'privoxy_req_put' => 'PUT', + 'privoxy_req_trace' => 'TRACE', + ]; +} elseif ($vars['privoxyPage'] == 'http_resp') { + $graphs = [ + 'privoxy_resp_xxx' => 'Response Code Types', + 'privoxy_resp_1xx' => '1xx', + 'privoxy_resp_2xx' => '2xx', + 'privoxy_resp_200' => '200', + 'privoxy_resp_2xx_other' => '2xx Other', + 'privoxy_resp_3xx' => '3xx', + 'privoxy_resp_301' => '301', + 'privoxy_resp_302' => '302', + 'privoxy_resp_303' => '303', + 'privoxy_resp_3xx_other' => '3xx Other', + 'privoxy_resp_4xx' => '4xx', + 'privoxy_resp_403' => '403', + 'privoxy_resp_404' => '404', + 'privoxy_resp_451' => '451', + 'privoxy_resp_4xx_other' => '4xx Other', + 'privoxy_resp_5xx' => '5xx', + 'privoxy_resp_500' => '500', + 'privoxy_resp_502' => '502', + 'privoxy_resp_503' => '503', + 'privoxy_resp_504' => '504', + 'privoxy_resp_5xx_other' => '5xx Other', + ]; +} elseif ($vars['privoxyPage'] == 'domains') { + $graphs = [ + 'privoxy_unique_domains' => 'Unique Domains', + 'privoxy_unique_bdomains' => 'Unique Domains, Blocked', + 'privoxy_unique_domains_np' => 'Unique Domains Without Port', + 'privoxy_unique_bdomains_np' => 'Unique Domains Without Port, Blocked', + 'privoxy_ubd_per' => 'Percent Of Unique Domains Blocked', + 'privoxy_ubd_np_per' => 'Percent Of Unique Domains Blocked, No Port', + ]; +} + +foreach ($graphs as $key => $text) { + $graph_type = $key; + $graph_array['height'] = '100'; + $graph_array['width'] = '215'; + $graph_array['to'] = \LibreNMS\Config::get('time.now'); + $graph_array['id'] = $app['app_id']; + $graph_array['type'] = 'application_' . $key; + + echo '
+
+

' . $text . '

+
+
+
'; + include 'includes/html/print-graphrow.inc.php'; + echo '
'; + echo '
'; + echo '
'; +} diff --git a/includes/polling/applications/privoxy.inc.php b/includes/polling/applications/privoxy.inc.php new file mode 100644 index 0000000000..ca1b2a3952 --- /dev/null +++ b/includes/polling/applications/privoxy.inc.php @@ -0,0 +1,148 @@ +getCode() . ':' . $e->getMessage() . PHP_EOL; + update_application($app, $e->getCode() . ':' . $e->getMessage(), []); // Set empty metrics and error message + + return; +} + +$fields = [ + 'block_percent' => 0, + 'blocks' => 0, + 'bytes_to_client' => 0, + 'client_cons' => 0, + 'client_requests' => 0, + 'con_failures' => 0, + 'con_timeouts' => 0, + 'crunches' => 0, + 'empty_resps' => 0, + 'empty_resps_new' => 0, + 'empty_resps_reuse' => 0, + 'fast_redirs' => 0, + 'imp_accounted' => 0, + 'max_reqs' => 0, + 'nog_conns' => 0, + 'out_requests' => 0, + 'req_connect' => 0, + 'req_delete' => 0, + 'req_get' => 0, + 'req_head' => 0, + 'req_options' => 0, + 'req_patch' => 0, + 'req_post' => 0, + 'req_put' => 0, + 'req_trace' => 0, + 'resp_1xx' => 0, + 'resp_200' => 0, + 'resp_2xx' => 0, + 'resp_2xx_other' => 0, + 'resp_301' => 0, + 'resp_302' => 0, + 'resp_303' => 0, + 'resp_3xx' => 0, + 'resp_3xx_other' => 0, + 'resp_403' => 0, + 'resp_404' => 0, + 'resp_451' => 0, + 'resp_4xx' => 0, + 'resp_4xx_other' => 0, + 'resp_500' => 0, + 'resp_502' => 0, + 'resp_503' => 0, + 'resp_504' => 0, + 'resp_5xx' => 0, + 'resp_5xx_other' => 0, + 'reused_server_cons' => 0, + 'ska_offers' => 0, + 'ubd_np_per' => 0, + 'ubd_per' => 0, + 'unique_bdomains' => 0, + 'unique_bdomains_np' => 0, + 'unique_domains' => 0, + 'unique_domains_np' => 0, + 'ver_1_0' => 0, + 'ver_1_1' => 0, + 'ver_2' => 0, + 'ver_3' => 0, +]; + +$rrd_def = RrdDefinition::make() + ->addDataset('block_percent', 'GAUGE', 0) + ->addDataset('blocks', 'GAUGE', 0) + ->addDataset('bytes_to_client', 'GAUGE', 0) + ->addDataset('client_cons', 'GAUGE', 0) + ->addDataset('client_requests', 'GAUGE', 0) + ->addDataset('con_failures', 'GAUGE', 0) + ->addDataset('con_timeouts', 'GAUGE', 0) + ->addDataset('crunches', 'GAUGE', 0) + ->addDataset('empty_resps', 'GAUGE', 0) + ->addDataset('empty_resps_new', 'GAUGE', 0) + ->addDataset('empty_resps_reuse', 'GAUGE', 0) + ->addDataset('fast_redirs', 'GAUGE', 0) + ->addDataset('imp_accounted', 'GAUGE', 0) + ->addDataset('max_reqs', 'GAUGE', 0) + ->addDataset('nog_conns', 'GAUGE', 0) + ->addDataset('out_requests', 'GAUGE', 0) + ->addDataset('req_connect', 'GAUGE', 0) + ->addDataset('req_delete', 'GAUGE', 0) + ->addDataset('req_get', 'GAUGE', 0) + ->addDataset('req_head', 'GAUGE', 0) + ->addDataset('req_options', 'GAUGE', 0) + ->addDataset('req_patch', 'GAUGE', 0) + ->addDataset('req_post', 'GAUGE', 0) + ->addDataset('req_put', 'GAUGE', 0) + ->addDataset('req_trace', 'GAUGE', 0) + ->addDataset('resp_1xx', 'GAUGE', 0) + ->addDataset('resp_200', 'GAUGE', 0) + ->addDataset('resp_2xx', 'GAUGE', 0) + ->addDataset('resp_2xx_other', 'GAUGE', 0) + ->addDataset('resp_301', 'GAUGE', 0) + ->addDataset('resp_302', 'GAUGE', 0) + ->addDataset('resp_303', 'GAUGE', 0) + ->addDataset('resp_3xx', 'GAUGE', 0) + ->addDataset('resp_3xx_other', 'GAUGE', 0) + ->addDataset('resp_403', 'GAUGE', 0) + ->addDataset('resp_404', 'GAUGE', 0) + ->addDataset('resp_451', 'GAUGE', 0) + ->addDataset('resp_4xx', 'GAUGE', 0) + ->addDataset('resp_4xx_other', 'GAUGE', 0) + ->addDataset('resp_500', 'GAUGE', 0) + ->addDataset('resp_502', 'GAUGE', 0) + ->addDataset('resp_503', 'GAUGE', 0) + ->addDataset('resp_504', 'GAUGE', 0) + ->addDataset('resp_5xx', 'GAUGE', 0) + ->addDataset('resp_5xx_other', 'GAUGE', 0) + ->addDataset('reused_server_cons', 'GAUGE', 0) + ->addDataset('ska_offers', 'GAUGE', 0) + ->addDataset('ubd_np_per', 'GAUGE', 0) + ->addDataset('ubd_per', 'GAUGE', 0) + ->addDataset('unique_bdomains', 'GAUGE', 0) + ->addDataset('unique_bdomains_np', 'GAUGE', 0) + ->addDataset('unique_domains', 'GAUGE', 0) + ->addDataset('unique_domains_np', 'GAUGE', 0) + ->addDataset('ver_1_0', 'GAUGE', 0) + ->addDataset('ver_1_1', 'GAUGE', 0) + ->addDataset('ver_2', 'GAUGE', 0) + ->addDataset('ver_3', 'GAUGE', 0); + +foreach ($fields as $key => $value) { + if (isset($returned['data'][$key])) { + $fields[$key] = $returned['data'][$key]; + } +} + +$rrd_name = ['app', $name, $app->app_id]; +$tags = ['name' => $name, 'app_id' => $app->app_id, 'rrd_def' => $rrd_def, 'rrd_name' => $rrd_name]; +data_update($device, 'app', $tags, $fields); + +// +// all done so update the app metrics +// +update_application($app, 'OK', $fields); diff --git a/tests/data/linux_privoxy-v1.json b/tests/data/linux_privoxy-v1.json new file mode 100644 index 0000000000..0bbfbf990a --- /dev/null +++ b/tests/data/linux_privoxy-v1.json @@ -0,0 +1,374 @@ +{ + "applications": { + "discovery": { + "applications": [ + { + "app_type": "privoxy", + "app_state": "UNKNOWN", + "discovered": 1, + "app_state_prev": null, + "app_status": "", + "app_instance": "", + "data": null + } + ] + }, + "poller": { + "applications": [ + { + "app_type": "privoxy", + "app_state": "OK", + "discovered": 1, + "app_state_prev": "UNKNOWN", + "app_status": "", + "app_instance": "", + "data": null + } + ], + "application_metrics": [ + { + "metric": "block_percent", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "blocks", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "bytes_to_client", + "value": 11398923, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "client_cons", + "value": 27, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "client_requests", + "value": 20, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "con_failures", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "con_timeouts", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "crunches", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "empty_resps", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "empty_resps_new", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "empty_resps_reuse", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "fast_redirs", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "imp_accounted", + "value": 7, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "max_reqs", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "nog_conns", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "out_requests", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_connect", + "value": 20, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_delete", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_get", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_head", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_options", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_patch", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_post", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_put", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "req_trace", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_1xx", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_200", + "value": 20, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_2xx", + "value": 20, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_2xx_other", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_301", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_302", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_303", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_3xx", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_3xx_other", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_403", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_404", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_451", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_4xx", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_4xx_other", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_500", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_502", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_503", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_504", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_5xx", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "resp_5xx_other", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "reused_server_cons", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ska_offers", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ubd_np_per", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ubd_per", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "unique_bdomains", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "unique_bdomains_np", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "unique_domains", + "value": 10, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "unique_domains_np", + "value": 10, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ver_1_0", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ver_1_1", + "value": 20, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ver_2", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + }, + { + "metric": "ver_3", + "value": 0, + "value_prev": null, + "app_type": "privoxy" + } + ] + } + } +} diff --git a/tests/snmpsim/linux_privoxy-v1.snmprec b/tests/snmpsim/linux_privoxy-v1.snmprec new file mode 100644 index 0000000000..38ea44812d --- /dev/null +++ b/tests/snmpsim/linux_privoxy-v1.snmprec @@ -0,0 +1,10 @@ +1.3.6.1.2.1.1.1.0|4|Linux server 3.10.0-693.5.2.el7.x86_64 #1 SMP Fri Oct 20 20:32:50 UTC 2017 x86_64 +1.3.6.1.2.1.1.2.0|6|1.3.6.1.4.1.8072.3.2.10 +1.3.6.1.2.1.1.3.0|67|77550514 +1.3.6.1.2.1.1.4.0|4| +1.3.6.1.2.1.1.5.0|4| +1.3.6.1.2.1.1.6.0|4| +1.3.6.1.2.1.25.1.1.0|67|77552962 +1.3.6.1.4.1.8072.1.3.2.2.1.21.6.100.105.115.116.114.111|2|1 +1.3.6.1.4.1.8072.1.3.2.2.1.21.7.112.114.105.118.111.120.121|2|1 +1.3.6.1.4.1.8072.1.3.2.3.1.2.7.112.114.105.118.111.120.121|4x|7b2264617461223a7b22626c6f636b5f70657263656e74223a302c22626c6f636b73223a302c2262797465735f746f5f636c69656e74223a223131333938393233222c22636c69656e745f636f6e73223a223237222c22636c69656e745f7265717565737473223a223230222c22636f6e5f6661696c75726573223a302c22636f6e5f74696d656f757473223a302c226372756e63686573223a302c22656d7074795f7265737073223a2230222c22656d7074795f72657370735f6e6577223a2230222c22656d7074795f72657370735f7265757365223a2230222c22666173745f726564697273223a302c22696d705f6163636f756e746564223a2237222c226d61785f72657173223a302c226e6f675f636f6e6e73223a2230222c226f75745f7265717565737473223a302c227265715f636f6e6e656374223a223230222c227265715f64656c657465223a302c227265715f676574223a302c227265715f68656164223a302c227265715f6f7074696f6e73223a302c227265715f7061746368223a302c227265715f706f7374223a302c227265715f707574223a302c227265715f7472616365223a302c22726573705f317878223a302c22726573705f323030223a223230222c22726573705f327878223a32302c22726573705f3278785f6f74686572223a302c22726573705f333031223a302c22726573705f333032223a302c22726573705f333033223a302c22726573705f337878223a302c22726573705f3378785f6f74686572223a302c22726573705f343033223a302c22726573705f343034223a302c22726573705f343531223a302c22726573705f347878223a302c22726573705f3478785f6f74686572223a302c22726573705f353030223a302c22726573705f353032223a302c22726573705f353033223a302c22726573705f353034223a302c22726573705f357878223a302c22726573705f3578785f6f74686572223a302c227265757365645f7365727665725f636f6e73223a2230222c22736b615f6f6666657273223a2230222c227562645f6e705f706572223a302c227562645f706572223a302c22756e697175655f62646f6d61696e73223a302c22756e697175655f62646f6d61696e735f6e70223a302c22756e697175655f646f6d61696e73223a31302c22756e697175655f646f6d61696e735f6e70223a31302c227665725f315f30223a302c227665725f315f31223a223230222c227665725f32223a302c227665725f33223a307d2c226572726f72223a302c226572726f72537472696e67223a22222c2276657273696f6e223a317d0a