diff --git a/zabbix_scripts/check_httpd b/zabbix_scripts/check_httpd index 180726a..5027bd1 100644 --- a/zabbix_scripts/check_httpd +++ b/zabbix_scripts/check_httpd @@ -4,6 +4,7 @@ use strict; use warnings; use LWP::Simple; use Getopt::Long; +use JSON; my $uri = 'http://127.0.0.1/server-status'; my $what = undef; @@ -36,13 +37,16 @@ foreach my $line (split(/\n/, $status)){ $res{$key} = $val; } -if ($help || !$what){ +if ($help){ print "Valid keys are:\n\n"; print "$_\n" for keys %res; exit 0; } -if (defined $res{$what}){ +if (!$what){ + print to_json(\%res); +} +elsif (defined $res{$what}){ print $res{$what}; } else{