####
our $VERSION='0.01';
use 5.005;
use strict;
use warnings;
use Data::Dump::Streamer;
use JSON::XS;
use Devel::StackTrace;
use Module::Load::Conditional qw[can_load];
require Exporter;
our @I
_[3];
my $json='';
my $hash='';
my $stderr='';
while (1) {
if ($handle) {
($json,$stderr)=$handle->cmd($c);
$hash=decode_json($json) if $json and $json=~/^\s*[{]/s;
json.=$line;
}
close AWS;
if (-1<index $json,'A client error') {
die $json;
} elsif ($json=~/^\s*[{]/) {
$hash=decode_json
r @results;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/portssid.tt', { results => $json }, { layout => 'noop' };
}
else {
hea
};
}
if (request->is_ajax) {
my $json = to_json (\@results);
template 'ajax/report/portvlanmismatch.tt', { results => $json }, { layout => 'noop' };
}
else {
tered = $rs->get_datatables_filtered_count($exp_params);
content_type 'application/json';
return to_json(
{ draw => int( param('draw') ),
recordsTotal => i
@results;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/halfduplex.tt', { results => $json }, { layout => 'noop' };
}
else {
he
@results;
if ( request->is_ajax ) {
my $json = to_json (\@results);
template 'ajax/report/portblocking.tt', { results => $json }, { layout => 'noop' };
}
else {
he
ults;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/portssid.tt',
{ results => $json, opt => $ssid }, { layout => 'noop' };
}
@results;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/apclients.tt', { results => $json }, { layout => 'noop' };
}
else {
hea
@results;
if ( request->is_ajax ) {
my $json = to_json (\@results);
template 'ajax/report/portadmindown.tt', { results => $json }, { layout => 'noop' };
}
else {
h
=~ m/^\.1(\.\d+)*$/ or send_error('Bad OID Base', 404);
content_type 'application/json';
return to_json [{
text => 'No data for this device. Admins can request a snapshot in the Detail
unt;
# snapshot should run a loadmibs, but just in case that didn't happen...
return to_json [{
text => 'No MIB objects. Please run a loadmibs job.',
children => \0,
state
et_snmp_data($device->ip, $base);
to_json $items;
};
ajax '/ajax/data/snmp/typeahead' => require_login sub {
my $term = param('term') or return to_json [];
my $device = param('ip');
results;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/duplexmismatch.tt', { results => $json, }, { layout => 'noop' };
}
else {
my $p = param('positions') or send_error('Missing positions', 400);
my $positions = from_json($p) or send_error('Bad positions', 400);
send_error('Bad positions', 400) unless ref [] eq re
,
vlan => ($vlan || 0),
});
if ($posrow) {
$posrow->update({ positions => to_json(\%clean) });
}
else {
schema(vars->{'tenant'})->resultset('NetmapPositions')->creat
],
locations => [sort @lgrplist],
vlan => ($vlan || 0),
positions => to_json(\%clean),
});
}
};
sub make_node_infostring {
my $node = shift or return '';
my $f
ar @results;
if (request->is_ajax) {
my $json = to_json( \@results );
template 'ajax/device/addresses.tt', { results => $json },
{ layout => undef };
}
else {
scalar @results;
if (request->is_ajax) {
my $json = to_json( \@results );
template 'ajax/device/vlans.tt', { results => $json },
{ layout => 'noop' };
}
else {
esults;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/nodesdiscovered.tt', { results => $json }, { layout => 'noop' };
}
else {
tered = $rs->get_datatables_filtered_count($exp_params);
content_type 'application/json';
return to_json(
{ draw => int( param('draw') ),
recordsTotal => i
esults;
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/devicebylocation.tt', { results => $json }, { layout => 'noop' };
}
else {
tered = $rs->get_datatables_filtered_count($exp_params);
content_type 'application/json';
return to_json(
{ draw => int( param('draw') ),
recordsTotal => i
}
if ( request->is_ajax ) {
my $json = to_json( \@results );
template 'ajax/report/nodevendor.tt',
{ results => $json, opt => $vendor },
{ layout => 'no
#!/usr/bin/env perl
use strict;
use warnings;
use autodie qw(:all);
use JSON::MaybeXS;
use File::Glob ':glob';
use File::Slurp;
use File::stat;
use POSIX qw(strftime);
use Readonly;
Readonly my %co
r_db => 'cover_db/cover.json',
output => 'cover_html/index.html'
);
# Read and decode coverage data
my $json_text = read_file($config{cover_db});
my $data = decode_json($json_text);
my $coverage_pc
ob("coverage_history/*.json");
# Cache historical data instead of reading for each file
my %historical_cache;
for my $hist_file (@history_files) {
my $json = eval { decode_json(read_file($hist_file)
>hri->all;
if (request->is_ajax) {
my $json = to_json (\@results);
template 'ajax/report/portutilization.tt', { results => $json }, { layout => 'noop' };
}
else {