����JFIF��x�x����'
Server IP : 78.140.185.180 / Your IP : 18.218.161.96 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /usr/lib64/nagios/plugins/extra/ |
Upload File : |
#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use JSON::XS; use Getopt::Std; my $status = 0; my %opts; getopts( 'u:s:t:', \%opts ); $opts{t} = 60 unless ( defined $opts{t} ); if ( not( defined $opts{u} and defined $opts{s} ) ) { print "ERROR: INVALID USAGE\n"; HELP_MESSAGE(); exit 3; } my $ua = LWP::UserAgent->new; $ua->timeout( $opts{t} ); my $server_endpoint = $opts{u}; my $signature = $opts{s}; my $req = HTTP::Request->new( GET => $server_endpoint ); $req->header( 'accept' => 'application/json' ); $req->header( 'content-type' => 'application/json' ); $req->header( 'SIGNATURE' => $signature ); my $resp = $ua->request($req); if ( $resp->is_success ) { my $domain = decode_json( $resp->content )->{data}->{domain}; my $available = decode_json( $resp->content )->{data}->{available}; if ( $domain ne 'fozzy.com' && $available != 0 ) { print "Response incorrect:\n"; print "$resp->decoded_content"; $status = 2; } else { print "API response is OK\n"; } } else { print "HTTP GET error code: ", $resp->code, "\n"; print "HTTP GET error message: ", $resp->message, "\n"; $status = 2; } sub HELP_MESSAGE { print <<EOHELP Retrieve an http/s URL and looks in its output for a given answer. Returns CRITICAL if response is not match fozzy.com and availiable not "false", and OK if match. --help shows this message --version shows version information -u URL to retrieve (http or https) -s SIGNATURE -t Timeout in seconds to wait for the URL to load. If the page fails to load, plugin will exit with UNKNOWN state (default 60) EOHELP ; } exit "$status";