diff --git a/lib/Resmon/Status.pm b/lib/Resmon/Status.pm index 5a3e8a2716fbc57d06710d812cb906ef1d8531a8..8ed82a6f03412dab960d44ebbdf3fac55e6f5504 100644 --- a/lib/Resmon/Status.pm +++ b/lib/Resmon/Status.pm @@ -182,14 +182,6 @@ sub dump_generic_module { my $info = $services->{$service}; $rv .= $dumper->($module,$service,$info); } - if ($module eq "Core::Resmon") { - my $info = { - name => 'now', - type => 'i', - value => time(), - }; - $rv .= $dumper->($module,"now",$info); - } return $rv; } sub dump_xml { @@ -374,7 +366,18 @@ sub service { $client->print($response . "\r\n"); return; } elsif($req =~ /^\/([^\/]+)\/(.+)\?plain$/) { - if(exists($self->{store}->{$1}) && + if($1 eq "System::Time" && $2 eq "now") { + my $info = { + name => 'now', + type => 'i', + value => time(), + }; + my $response = plain_info($1,$2,$info); + $client->print(http_header(200, length($response), 'text/plain', $snip)); + $client->print( $response . "\r\n"); + return; + } + elsif(exists($self->{store}->{$1}) && exists($self->{store}->{$1}->{$2})) { my $info = $self->{store}->{$1}->{$2}; my $response = plain_info($1,$2,$info); @@ -383,7 +386,22 @@ sub service { return; } } elsif($req =~ /^\/([^\/]+)\/(.+)$/) { - if(exists($self->{store}->{$1}) && + if($1 eq "System::Time" && $2 eq "now") { + my $info = { + name => 'now', + type => 'i', + value => time(), + }; + my $response = qq^<?xml version="1.0" encoding="UTF-8"?>\n^; + $response .= qq^<?xml-stylesheet type="text/xsl" href="/resmon.xsl"?>^; + $response .= "<ResmonResults>\n". + xml_info($1,$2,$info). + "</ResmonResults>\n"; + $client->print(http_header(200, length($response), 'text/xml', $snip)); + $client->print( $response . "\r\n"); + return; + } + elsif(exists($self->{store}->{$1}) && exists($self->{store}->{$1}->{$2})) { my $info = $self->{store}->{$1}->{$2}; my $response = qq^<?xml version="1.0" encoding="UTF-8"?>\n^;