Netapp devices monitoring
Re: Netapp devices monitoring
Please attach (or PM) the Netapp Manageability SDK so I can review the modules.
-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Netapp devices monitoring
Hello,
I am unable to attach the zip folder.
Can you please tell me which file exactly you want to see? I will try to upload the same.
I am unable to attach the zip folder.
Can you please tell me which file exactly you want to see? I will try to upload the same.
Re: Netapp devices monitoring
Please attach these files:
Code: Select all
/usr/lib64/perl5/URI/Escape.pm
/usr/lib64/perl5/URI.pm
/usr/share/perl5/base.pm
/usr/share/perl5/vendor_perl/HTTP/Request.pm
/usr/share/perl5/vendor_perl/LWP/UserAgent.pm
/usr/lib64/perl5/NaServer.pm-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Netapp devices monitoring
Hello,
PFA the files.
I am unable to attach more than 5 files, so adding the content of one file below.
URI.pm content is below:
package URI;
use strict;
use vars qw($VERSION);
$VERSION = "1.37";
use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER);
my %implements; # mapping from scheme to implementor class
# Some "official" character classes
use vars qw($reserved $mark $unreserved $uric $scheme_re);
$reserved = q(;/?:@&=+$,[]);
$mark = q(-_.!~*'()); #'; emacs
$unreserved = "A-Za-z0-9\Q$mark\E";
$uric = quotemeta($reserved) . $unreserved . "%";
$scheme_re = '[a-zA-Z][a-zA-Z0-9.+\-]*';
use Carp ();
use URI::Escape ();
use overload ('""' => sub { ${$_[0]} },
'==' => sub { overload::StrVal($_[0]) eq
overload::StrVal($_[1])
},
fallback => 1,
);
sub new
{
my($class, $uri, $scheme) = @_;
$uri = defined ($uri) ? "$uri" : ""; # stringify
# Get rid of potential wrapping
$uri =~ s/^<(?:URL:)?(.*)>$/$1/; #
$uri =~ s/^"(.*)"$/$1/;
$uri =~ s/^\s+//;
$uri =~ s/\s+$//;
my $impclass;
if ($uri =~ m/^($scheme_re):/so) {
$scheme = $1;
}
else {
if (($impclass = ref($scheme))) {
$scheme = $scheme->scheme;
}
elsif ($scheme && $scheme =~ m/^($scheme_re)(?::|$)/o) {
$scheme = $1;
}
}
$impclass ||= implementor($scheme) ||
do {
require URI::_foreign;
$impclass = 'URI::_foreign';
};
return $impclass->_init($uri, $scheme);
}
sub new_abs
{
my($class, $uri, $base) = @_;
$uri = $class->new($uri, $base);
$uri->abs($base);
}
sub _init
{
my $class = shift;
my($str, $scheme) = @_;
# find all funny characters and encode the bytes.
$str =~ s*([^$uric\#])* URI::Escape::escape_char($1) *ego;
$str = "$scheme:$str" unless $str =~ /^$scheme_re:/o ||
$class->_no_scheme_ok;
my $self = bless \$str, $class;
$self;
}
sub implementor
{
my($scheme, $impclass) = @_;
if (!$scheme || $scheme !~ /\A$scheme_re\z/o) {
require URI::_generic;
return "URI::_generic";
}
$scheme = lc($scheme);
if ($impclass) {
# Set the implementor class for a given scheme
my $old = $implements{$scheme};
$impclass->_init_implementor($scheme);
$implements{$scheme} = $impclass;
return $old;
}
my $ic = $implements{$scheme};
return $ic if $ic;
# scheme not yet known, look for internal or
# preloaded (with 'use') implementation
$ic = "URI::$scheme"; # default location
# turn scheme into a valid perl identifier by a simple tranformation...
$ic =~ s/\+/_P/g;
$ic =~ s/\./_O/g;
$ic =~ s/\-/_/g;
no strict 'refs';
# check we actually have one for the scheme:
unless (@{"${ic}::ISA"}) {
# Try to load it
eval "require $ic";
die $@ if $@ && $@ !~ /Can\'t locate.*in \@INC/;
return unless @{"${ic}::ISA"};
}
$ic->_init_implementor($scheme);
$implements{$scheme} = $ic;
$ic;
}
sub _init_implementor
{
my($class, $scheme) = @_;
# Remember that one implementor class may actually
# serve to implement several URI schemes.
}
sub clone
{
my $self = shift;
my $other = $$self;
bless \$other, ref $self;
}
sub _no_scheme_ok { 0 }
sub _scheme
{
my $self = shift;
unless (@_) {
return unless $$self =~ /^($scheme_re):/o;
return $1;
}
my $old;
my $new = shift;
if (defined($new) && length($new)) {
Carp::croak("Bad scheme '$new'") unless $new =~ /^$scheme_re$/o;
$old = $1 if $$self =~ s/^($scheme_re)://o;
my $newself = URI->new("$new:$$self");
$$self = $$newself;
bless $self, ref($newself);
}
else {
if ($self->_no_scheme_ok) {
$old = $1 if $$self =~ s/^($scheme_re)://o;
Carp::carp("Oops, opaque part now look like scheme")
if $^W && $$self =~ m/^$scheme_re:/o
}
else {
$old = $1 if $$self =~ m/^($scheme_re):/o;
}
}
return $old;
}
sub scheme
{
my $scheme = shift->_scheme(@_);
return unless defined $scheme;
lc($scheme);
}
sub opaque
{
my $self = shift;
unless (@_) {
$$self =~ /^(?:$scheme_re:)?([^\#]*)/o or die;
return $1;
}
$$self =~ /^($scheme_re:)? # optional scheme
([^\#]*) # opaque
(\#.*)? # optional fragment
$/sx or die;
my $old_scheme = $1;
my $old_opaque = $2;
my $old_frag = $3;
my $new_opaque = shift;
$new_opaque = "" unless defined $new_opaque;
$new_opaque =~ s/([^$uric])/ URI::Escape::escape_char($1)/ego;
$$self = defined($old_scheme) ? $old_scheme : "";
$$self .= $new_opaque;
$$self .= $old_frag if defined $old_frag;
$old_opaque;
}
*path = \&opaque; # alias
sub fragment
{
my $self = shift;
unless (@_) {
return unless $$self =~ /\#(.*)/s;
return $1;
}
my $old;
$old = $1 if $$self =~ s/\#(.*)//s;
my $new_frag = shift;
if (defined $new_frag) {
$new_frag =~ s/([^$uric])/ URI::Escape::escape_char($1) /ego;
$$self .= "#$new_frag";
}
$old;
}
sub as_string
{
my $self = shift;
$$self;
}
sub canonical
{
# Make sure scheme is lowercased, that we don't escape unreserved chars,
# and that we use upcase escape sequences.
my $self = shift;
my $scheme = $self->_scheme || "";
my $uc_scheme = $scheme =~ /[A-Z]/;
my $esc = $$self =~ /%[a-fA-F0-9]{2}/;
return $self unless $uc_scheme || $esc;
my $other = $self->clone;
if ($uc_scheme) {
$other->_scheme(lc $scheme);
}
if ($esc) {
$$other =~ s{%([0-9a-fA-F]{2})}
{ my $a = chr(hex($1));
$a =~ /^[$unreserved]\z/o ? $a : "%\U$1"
}ge;
}
return $other;
}
# Compare two URIs, subclasses will provide a more correct implementation
sub eq {
my($self, $other) = @_;
$self = URI->new($self, $other) unless ref $self;
$other = URI->new($other, $self) unless ref $other;
ref($self) eq ref($other) && # same class
$self->canonical->as_string eq $other->canonical->as_string;
}
# generic-URI transformation methods
sub abs { $_[0]; }
sub rel { $_[0]; }
# help out Storable
sub STORABLE_freeze {
my($self, $cloning) = @_;
return $$self;
}
sub STORABLE_thaw {
my($self, $cloning, $str) = @_;
$$self = $str;
}
1;
__END__
=head1 NAME
URI - Uniform Resource Identifiers (absolute and relative)
=head1 SYNOPSIS
$u1 = URI->new("http://www.perl.com");
$u2 = URI->new("foo", "http");
$u3 = $u2->abs($u1);
$u4 = $u3->clone;
$u5 = URI->new("HTTP://WWW.perl.com:80")->canonical;
$str = $u->as_string;
$str = "$u";
$scheme = $u->scheme;
$opaque = $u->opaque;
$path = $u->path;
$frag = $u->fragment;
$u->scheme("ftp");
$u->host("ftp.perl.com");
$u->path("cpan/");
=head1 DESCRIPTION
This module implements the C<URI> class. Objects of this class
represent "Uniform Resource Identifier references" as specified in RFC
2396 (and updated by RFC 2732).
A Uniform Resource Identifier is a compact string of characters that
identifies an abstract or physical resource. A Uniform Resource
Identifier can be further classified as either a Uniform Resource Locator
(URL) or a Uniform Resource Name (URN). The distinction between URL
and URN does not matter to the C<URI> class interface. A
"URI-reference" is a URI that may have additional information attached
in the form of a fragment identifier.
An absolute URI reference consists of three parts: a I<scheme>, a
I<scheme-specific part> and a I<fragment> identifier. A subset of URI
references share a common syntax for hierarchical namespaces. For
these, the scheme-specific part is further broken down into
I<authority>, I<path> and I<query> components. These URIs can also
take the form of relative URI references, where the scheme (and
usually also the authority) component is missing, but implied by the
context of the URI reference. The three forms of URI reference
syntax are summarized as follows:
<scheme>:<scheme-specific-part>#<fragment>
<scheme>://<authority><path>?<query>#<fragment>
<path>?<query>#<fragment>
The components into which a URI reference can be divided depend on the
I<scheme>. The C<URI> class provides methods to get and set the
individual components. The methods available for a specific
C<URI> object depend on the scheme.
=head1 CONSTRUCTORS
The following methods construct new C<URI> objects:
=over 4
=item $uri = URI->new( $str )
=item $uri = URI->new( $str, $scheme )
Constructs a new URI object. The string
representation of a URI is given as argument, together with an optional
scheme specification. Common URI wrappers like "" and <>, as well as
leading and trailing white space, are automatically removed from
the $str argument before it is processed further.
The constructor determines the scheme, maps this to an appropriate
URI subclass, constructs a new object of that class and returns it.
The $scheme argument is only used when $str is a
relative URI. It can be either a simple string that
denotes the scheme, a string containing an absolute URI reference, or
an absolute C<URI> object. If no $scheme is specified for a relative
URI $str, then $str is simply treated as a generic URI (no scheme-specific
methods available).
The set of characters available for building URI references is
restricted (see L<URI::Escape>). Characters outside this set are
automatically escaped by the URI constructor.
=item $uri = URI->new_abs( $str, $base_uri )
Constructs a new absolute URI object. The $str argument can
denote a relative or absolute URI. If relative, then it is
absolutized using $base_uri as base. The $base_uri must be an absolute
URI.
=item $uri = URI::file->new( $filename )
=item $uri = URI::file->new( $filename, $os )
Constructs a new I<file> URI from a file name. See L<URI::file>.
=item $uri = URI::file->new_abs( $filename )
=item $uri = URI::file->new_abs( $filename, $os )
Constructs a new absolute I<file> URI from a file name. See
L<URI::file>.
=item $uri = URI::file->cwd
Returns the current working directory as a I<file> URI. See
L<URI::file>.
=item $uri->clone
Returns a copy of the $uri.
=back
=head1 COMMON METHODS
The methods described in this section are available for all C<URI>
objects.
Methods that give access to components of a URI always return the
old value of the component. The value returned is C<undef> if the
component was not present. There is generally a difference between a
component that is empty (represented as C<"">) and a component that is
missing (represented as C<undef>). If an accessor method is given an
argument, it updates the corresponding component in addition to
returning the old value of the component. Passing an undefined
argument removes the component (if possible). The description of
each accessor method indicates whether the component is passed as
an escaped or an unescaped string. A component that can be further
divided into sub-parts are usually passed escaped, as unescaping might
change its semantics.
The common methods available for all URI are:
=over 4
=item $uri->scheme
=item $uri->scheme( $new_scheme )
Sets and returns the scheme part of the $uri. If the $uri is
relative, then $uri->scheme returns C<undef>. If called with an
argument, it updates the scheme of $uri, possibly changing the
class of $uri, and returns the old scheme value. The method croaks
if the new scheme name is illegal; a scheme name must begin with a
letter and must consist of only US-ASCII letters, numbers, and a few
special marks: ".", "+", "-". This restriction effectively means
that the scheme must be passed unescaped. Passing an undefined
argument to the scheme method makes the URI relative (if possible).
Letter case does not matter for scheme names. The string
returned by $uri->scheme is always lowercase. If you want the scheme
just as it was written in the URI in its original case,
you can use the $uri->_scheme method instead.
=item $uri->opaque
=item $uri->opaque( $new_opaque )
Sets and returns the scheme-specific part of the $uri
(everything between the scheme and the fragment)
as an escaped string.
=item $uri->path
=item $uri->path( $new_path )
Sets and returns the same value as $uri->opaque unless the URI
supports the generic syntax for hierarchical namespaces.
In that case the generic method is overridden to set and return
the part of the URI between the I<host name> and the I<fragment>.
=item $uri->fragment
=item $uri->fragment( $new_frag )
Returns the fragment identifier of a URI reference
as an escaped string.
=item $uri->as_string
Returns a URI object to a plain string. URI objects are
also converted to plain strings automatically by overloading. This
means that $uri objects can be used as plain strings in most Perl
constructs.
=item $uri->canonical
Returns a normalized version of the URI. The rules
for normalization are scheme-dependent. They usually involve
lowercasing the scheme and Internet host name components,
removing the explicit port specification if it matches the default port,
uppercasing all escape sequences, and unescaping octets that can be
better represented as plain characters.
For efficiency reasons, if the $uri is already in normalized form,
then a reference to it is returned instead of a copy.
=item $uri->eq( $other_uri )
=item URI::eq( $first_uri, $other_uri )
Tests whether two URI references are equal. URI references
that normalize to the same string are considered equal. The method
can also be used as a plain function which can also test two string
arguments.
If you need to test whether two C<URI> object references denote the
same object, use the '==' operator.
=item $uri->abs( $base_uri )
Returns an absolute URI reference. If $uri is already
absolute, then a reference to it is simply returned. If the $uri
is relative, then a new absolute URI is constructed by combining the
$uri and the $base_uri, and returned.
=item $uri->rel( $base_uri )
Returns a relative URI reference if it is possible to
make one that denotes the same resource relative to $base_uri.
If not, then $uri is simply returned.
=back
=head1 GENERIC METHODS
The following methods are available to schemes that use the
common/generic syntax for hierarchical namespaces. The descriptions of
schemes below indicate which these are. Unknown schemes are
assumed to support the generic syntax, and therefore the following
methods:
=over 4
=item $uri->authority
=item $uri->authority( $new_authority )
Sets and returns the escaped authority component
of the $uri.
=item $uri->path
=item $uri->path( $new_path )
Sets and returns the escaped path component of
the $uri (the part between the host name and the query or fragment).
The path can never be undefined, but it can be the empty string.
=item $uri->path_query
=item $uri->path_query( $new_path_query )
Sets and returns the escaped path and query
components as a single entity. The path and the query are
separated by a "?" character, but the query can itself contain "?".
=item $uri->path_segments
=item $uri->path_segments( $segment, ... )
Sets and returns the path. In a scalar context, it returns
the same value as $uri->path. In a list context, it returns the
unescaped path segments that make up the path. Path segments that
have parameters are returned as an anonymous array. The first element
is the unescaped path segment proper; subsequent elements are escaped
parameter strings. Such an anonymous array uses overloading so it can
be treated as a string too, but this string does not include the
parameters.
Note that absolute paths have the empty string as their first
I<path_segment>, i.e. the I<path> C</foo/bar> have 3
I<path_segments>; "", "foo" and "bar".
=item $uri->query
=item $uri->query( $new_query )
Sets and returns the escaped query component of
the $uri.
=item $uri->query_form
=item $uri->query_form( $key1 => $val1, $key2 => $val2, ... )
=item $uri->query_form( $key1 => $val1, $key2 => $val2, ..., $delim )
=item $uri->query_form( \@key_value_pairs )
=item $uri->query_form( \@key_value_pairs, $delim )
=item $uri->query_form( \%hash )
=item $uri->query_form( \%hash, $delim )
Sets and returns query components that use the
I<application/x-www-form-urlencoded> format. Key/value pairs are
separated by "&", and the key is separated from the value by a "="
character.
The form can be set either by passing separate key/value pairs, or via
an array or hash reference. Passing an empty array or an empty hash
removes the query component, whereas passing no arguments at all leaves
the component unchanged. The order of keys is undefined if a hash
reference is passed. The old value is always returned as a list of
separate key/value pairs. Assigning this list to a hash is unwise as
the keys returned might repeat.
The values passed when setting the form can be plain strings or
references to arrays of strings. Passing an array of values has the
same effect as passing the key repeatedly with one value at a time.
All the following statements have the same effect:
$uri->query_form(foo => 1, foo => 2);
$uri->query_form(foo => [1, 2]);
$uri->query_form([ foo => 1, foo => 2 ]);
$uri->query_form([ foo => [1, 2] ]);
$uri->query_form({ foo => [1, 2] });
The $delim parameter can be passed as ";" to force the key/value pairs
to be delimited by ";" instead of "&" in the query string. This
practice is often recommened for URLs embedded in HTML or XML
documents as this avoids the trouble of escaping the "&" character.
You might also set the $URI::DEFAULT_QUERY_FORM_DELIMITER variable to
";" for the same global effect.
The C<URI::QueryParam> module can be loaded to add further methods to
manipulate the form of a URI. See L<URI::QueryParam> for details.
=item $uri->query_keywords
=item $uri->query_keywords( $keywords, ... )
=item $uri->query_keywords( \@keywords )
Sets and returns query components that use the
keywords separated by "+" format.
The keywords can be set either by passing separate keywords directly
or by passing a reference to an array of keywords. Passing an empty
array removes the query component, whereas passing no arguments at
all leaves the component unchanged. The old value is always returned
as a list of separate words.
=back
=head1 SERVER METHODS
For schemes where the I<authority> component denotes an Internet host,
the following methods are available in addition to the generic
methods.
=over 4
=item $uri->userinfo
=item $uri->userinfo( $new_userinfo )
Sets and returns the escaped userinfo part of the
authority component.
For some schemes this is a user name and a password separated by
a colon. This practice is not recommended. Embedding passwords in
clear text (such as URI) has proven to be a security risk in almost
every case where it has been used.
=item $uri->host
=item $uri->host( $new_host )
Sets and returns the unescaped hostname.
If the $new_host string ends with a colon and a number, then this
number also sets the port.
=item $uri->port
=item $uri->port( $new_port )
Sets and returns the port. The port is a simple integer
that should be greater than 0.
If a port is not specified explicitly in the URI, then the URI scheme's default port
is returned. If you don't want the default port
substituted, then you can use the $uri->_port method instead.
=item $uri->host_port
=item $uri->host_port( $new_host_port )
Sets and returns the host and port as a single
unit. The returned value includes a port, even if it matches the
default port. The host part and the port part are separated by a
colon: ":".
=item $uri->default_port
Returns the default port of the URI scheme to which $uri
belongs. For I<http> this is the number 80, for I<ftp> this
is the number 21, etc. The default port for a scheme can not be
changed.
=back
=head1 SCHEME-SPECIFIC SUPPORT
Scheme-specific support is provided for the following URI schemes. For C<URI>
objects that do not belong to one of these, you can only use the common and
generic methods.
=over 4
=item B<data>:
The I<data> URI scheme is specified in RFC 2397. It allows inclusion
of small data items as "immediate" data, as if it had been included
externally.
C<URI> objects belonging to the data scheme support the common methods
and two new methods to access their scheme-specific components:
$uri->media_type and $uri->data. See L<URI::data> for details.
=item B<file>:
An old specification of the I<file> URI scheme is found in RFC 1738.
A new RFC 2396 based specification in not available yet, but file URI
references are in common use.
C<URI> objects belonging to the file scheme support the common and
generic methods. In addition, they provide two methods for mapping file URIs
back to local file names; $uri->file and $uri->dir. See L<URI::file>
for details.
=item B<ftp>:
An old specification of the I<ftp> URI scheme is found in RFC 1738. A
new RFC 2396 based specification in not available yet, but ftp URI
references are in common use.
C<URI> objects belonging to the ftp scheme support the common,
generic and server methods. In addition, they provide two methods for
accessing the userinfo sub-components: $uri->user and $uri->password.
=item B<gopher>:
The I<gopher> URI scheme is specified in
<draft-murali-url-gopher-1996-12-04> and will hopefully be available
as a RFC 2396 based specification.
C<URI> objects belonging to the gopher scheme support the common,
generic and server methods. In addition, they support some methods for
accessing gopher-specific path components: $uri->gopher_type,
$uri->selector, $uri->search, $uri->string.
=item B<http>:
The I<http> URI scheme is specified in RFC 2616.
The scheme is used to reference resources hosted by HTTP servers.
C<URI> objects belonging to the http scheme support the common,
generic and server methods.
=item B<https>:
The I<https> URI scheme is a Netscape invention which is commonly
implemented. The scheme is used to reference HTTP servers through SSL
connections. Its syntax is the same as http, but the default
port is different.
=item B<ldap>:
The I<ldap> URI scheme is specified in RFC 2255. LDAP is the
Lightweight Directory Access Protocol. An ldap URI describes an LDAP
search operation to perform to retrieve information from an LDAP
directory.
C<URI> objects belonging to the ldap scheme support the common,
generic and server methods as well as ldap-specific methods: $uri->dn,
$uri->attributes, $uri->scope, $uri->filter, $uri->extensions. See
L<URI::ldap> for details.
=item B<ldapi>:
Like the I<ldap> URI scheme, but uses a UNIX domain socket. The
server methods are not supported, and the local socket path is
available as $uri->un_path. The I<ldapi> scheme is used by the
OpenLDAP package. There is no real specification for it, but it is
mentioned in various OpenLDAP manual pages.
=item B<ldaps>:
Like the I<ldap> URI scheme, but uses an SSL connection. This
scheme is deprecated, as the preferred way is to use the I<start_tls>
mechanism.
=item B<mailto>:
The I<mailto> URI scheme is specified in RFC 2368. The scheme was
originally used to designate the Internet mailing address of an
individual or service. It has (in RFC 2368) been extended to allow
setting of other mail header fields and the message body.
C<URI> objects belonging to the mailto scheme support the common
methods and the generic query methods. In addition, they support the
following mailto-specific methods: $uri->to, $uri->headers.
=item B<mms>:
The I<mms> URL specification can be found at L<http://sdp.ppona.com/>
C<URI> objects belonging to the mms scheme support the common,
generic, and server methods, with the exception of userinfo and
query-related sub-components.
=item B<news>:
The I<news>, I<nntp> and I<snews> URI schemes are specified in
<draft-gilman-news-url-01> and will hopefully be available as an RFC
2396 based specification soon.
C<URI> objects belonging to the news scheme support the common,
generic and server methods. In addition, they provide some methods to
access the path: $uri->group and $uri->message.
=item B<nntp>:
See I<news> scheme.
=item B<pop>:
The I<pop> URI scheme is specified in RFC 2384. The scheme is used to
reference a POP3 mailbox.
C<URI> objects belonging to the pop scheme support the common, generic
and server methods. In addition, they provide two methods to access the
userinfo components: $uri->user and $uri->auth
=item B<rlogin>:
An old specification of the I<rlogin> URI scheme is found in RFC
1738. C<URI> objects belonging to the rlogin scheme support the
common, generic and server methods.
=item B<rtsp>:
The I<rtsp> URL specification can be found in section 3.2 of RFC 2326.
C<URI> objects belonging to the rtsp scheme support the common,
generic, and server methods, with the exception of userinfo and
query-related sub-components.
=item B<rtspu>:
The I<rtspu> URI scheme is used to talk to RTSP servers over UDP
instead of TCP. The syntax is the same as rtsp.
=item B<rsync>:
Information about rsync is available from http://rsync.samba.org.
C<URI> objects belonging to the rsync scheme support the common,
generic and server methods. In addition, they provide methods to
access the userinfo sub-components: $uri->user and $uri->password.
=item B<sip>:
The I<sip> URI specification is described in sections 19.1 and 25
of RFC 3261. C<URI> objects belonging to the sip scheme support the
common, generic, and server methods with the exception of path related
sub-components. In addition, they provide two methods to get and set
I<sip> parameters: $uri->params_form and $uri->params.
=item B<sips>:
See I<sip> scheme. Its syntax is the same as sip, but the default
port is different.
=item B<snews>:
See I<news> scheme. Its syntax is the same as news, but the default
port is different.
=item B<telnet>:
An old specification of the I<telnet> URI scheme is found in RFC
1738. C<URI> objects belonging to the telnet scheme support the
common, generic and server methods.
=item B<tn3270>:
These URIs are used like I<telnet> URIs but for connections to IBM
mainframes. C<URI> objects belonging to the tn3270 scheme support the
common, generic and server methods.
=item B<ssh>:
Information about ssh is available at http://www.openssh.com/.
C<URI> objects belonging to the ssh scheme support the common,
generic and server methods. In addition, they provide methods to
access the userinfo sub-components: $uri->user and $uri->password.
=item B<urn>:
The syntax of Uniform Resource Names is specified in RFC 2141. C<URI>
objects belonging to the urn scheme provide the common methods, and also the
methods $uri->nid and $uri->nss, which return the Namespace Identifier
and the Namespace-Specific String respectively.
The Namespace Identifier basically works like the Scheme identifier of
URIs, and further divides the URN namespace. Namespace Identifier
assignments are maintained at
<http://www.iana.org/assignments/urn-namespaces>.
Letter case is not significant for the Namespace Identifier. It is
always returned in lower case by the $uri->nid method. The $uri->_nid
method can be used if you want it in its original case.
=item B<urn>:B<isbn>:
The C<urn:isbn:> namespace contains International Standard Book
Numbers (ISBNs) and is described in RFC 3187. A C<URI> object belonging
to this namespace has the following extra methods (if the
Business::ISBN module is available): $uri->isbn,
$uri->isbn_publisher_code, $uri->isbn_group_code (formerly isbn_country_code,
which is still supported by issues a deprecation warning), $uri->isbn_as_ean.
=item B<urn>:B<oid>:
The C<urn:oid:> namespace contains Object Identifiers (OIDs) and is
described in RFC 3061. An object identifier consists of sequences of digits
separated by dots. A C<URI> object belonging to this namespace has an
additional method called $uri->oid that can be used to get/set the oid
value. In a list context, oid numbers are returned as separate elements.
=back
=head1 CONFIGURATION VARIABLES
The following configuration variables influence how the class and its
methods behave:
=over 4
=item $URI::ABS_ALLOW_RELATIVE_SCHEME
Some older parsers used to allow the scheme name to be present in the
relative URL if it was the same as the base URL scheme. RFC 2396 says
that this should be avoided, but you can enable this old behaviour by
setting the $URI::ABS_ALLOW_RELATIVE_SCHEME variable to a TRUE value.
The difference is demonstrated by the following examples:
URI->new("http:foo")->abs("http://host/a/b")
==> "http:foo"
local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
URI->new("http:foo")->abs("http://host/a/b")
==> "http:/host/a/foo"
=item $URI::ABS_REMOTE_LEADING_DOTS
You can also have the abs() method ignore excess ".."
segments in the relative URI by setting $URI::ABS_REMOTE_LEADING_DOTS
to a TRUE value. The difference is demonstrated by the following
examples:
URI->new("../../../foo")->abs("http://host/a/b")
==> "http://host/../../foo"
local $URI::ABS_REMOTE_LEADING_DOTS = 1;
URI->new("../../../foo")->abs("http://host/a/b")
==> "http://host/foo"
=item $URI::DEFAULT_QUERY_FORM_DELIMITER
This value can be set to ";" to have the query form C<key=value> pairs
delimited by ";" instead of "&" which is the default.
=back
=head1 BUGS
Using regexp variables like $1 directly as arguments to the URI methods
does not work too well with current perl implementations. I would argue
that this is actually a bug in perl. The workaround is to quote
them. Example:
/(...)/ || die;
$u->query("$1");
=head1 PARSING URIs WITH REGEXP
As an alternative to this module, the following (official) regular
expression can be used to decode a URI:
my($scheme, $authority, $path, $query, $fragment) =
$uri =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
The C<URI::Split> module provides the function uri_split() as a
readable alternative.
=head1 SEE ALSO
L<URI::file>, L<URI::WithBase>, L<URI::QueryParam>, L<URI::Escape>,
L<URI::Split>, L<URI::Heuristic>
RFC 2396: "Uniform Resource Identifiers (URI): Generic Syntax",
Berners-Lee, Fielding, Masinter, August 1998.
http://www.iana.org/assignments/uri-schemes
http://www.iana.org/assignments/urn-namespaces
http://www.w3.org/Addressing/
=head1 COPYRIGHT
Copyright 1995-2004,2008 Gisle Aas.
Copyright 1995 Martijn Koster.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 AUTHORS / ACKNOWLEDGMENTS
This module is based on the C<URI::URL> module, which in turn was
(distantly) based on the C<wwwurl.pl> code in the libwww-perl for
perl4 developed by Roy Fielding, as part of the Arcadia project at the
University of California, Irvine, with contributions from Brooks
Cutter.
C<URI::URL> was developed by Gisle Aas, Tim Bunce, Roy Fielding and
Martijn Koster with input from other people on the libwww-perl mailing
list.
C<URI> and related subclasses was developed by Gisle Aas.
=cut
PFA the files.
I am unable to attach more than 5 files, so adding the content of one file below.
URI.pm content is below:
package URI;
use strict;
use vars qw($VERSION);
$VERSION = "1.37";
use vars qw($ABS_REMOTE_LEADING_DOTS $ABS_ALLOW_RELATIVE_SCHEME $DEFAULT_QUERY_FORM_DELIMITER);
my %implements; # mapping from scheme to implementor class
# Some "official" character classes
use vars qw($reserved $mark $unreserved $uric $scheme_re);
$reserved = q(;/?:@&=+$,[]);
$mark = q(-_.!~*'()); #'; emacs
$unreserved = "A-Za-z0-9\Q$mark\E";
$uric = quotemeta($reserved) . $unreserved . "%";
$scheme_re = '[a-zA-Z][a-zA-Z0-9.+\-]*';
use Carp ();
use URI::Escape ();
use overload ('""' => sub { ${$_[0]} },
'==' => sub { overload::StrVal($_[0]) eq
overload::StrVal($_[1])
},
fallback => 1,
);
sub new
{
my($class, $uri, $scheme) = @_;
$uri = defined ($uri) ? "$uri" : ""; # stringify
# Get rid of potential wrapping
$uri =~ s/^<(?:URL:)?(.*)>$/$1/; #
$uri =~ s/^"(.*)"$/$1/;
$uri =~ s/^\s+//;
$uri =~ s/\s+$//;
my $impclass;
if ($uri =~ m/^($scheme_re):/so) {
$scheme = $1;
}
else {
if (($impclass = ref($scheme))) {
$scheme = $scheme->scheme;
}
elsif ($scheme && $scheme =~ m/^($scheme_re)(?::|$)/o) {
$scheme = $1;
}
}
$impclass ||= implementor($scheme) ||
do {
require URI::_foreign;
$impclass = 'URI::_foreign';
};
return $impclass->_init($uri, $scheme);
}
sub new_abs
{
my($class, $uri, $base) = @_;
$uri = $class->new($uri, $base);
$uri->abs($base);
}
sub _init
{
my $class = shift;
my($str, $scheme) = @_;
# find all funny characters and encode the bytes.
$str =~ s*([^$uric\#])* URI::Escape::escape_char($1) *ego;
$str = "$scheme:$str" unless $str =~ /^$scheme_re:/o ||
$class->_no_scheme_ok;
my $self = bless \$str, $class;
$self;
}
sub implementor
{
my($scheme, $impclass) = @_;
if (!$scheme || $scheme !~ /\A$scheme_re\z/o) {
require URI::_generic;
return "URI::_generic";
}
$scheme = lc($scheme);
if ($impclass) {
# Set the implementor class for a given scheme
my $old = $implements{$scheme};
$impclass->_init_implementor($scheme);
$implements{$scheme} = $impclass;
return $old;
}
my $ic = $implements{$scheme};
return $ic if $ic;
# scheme not yet known, look for internal or
# preloaded (with 'use') implementation
$ic = "URI::$scheme"; # default location
# turn scheme into a valid perl identifier by a simple tranformation...
$ic =~ s/\+/_P/g;
$ic =~ s/\./_O/g;
$ic =~ s/\-/_/g;
no strict 'refs';
# check we actually have one for the scheme:
unless (@{"${ic}::ISA"}) {
# Try to load it
eval "require $ic";
die $@ if $@ && $@ !~ /Can\'t locate.*in \@INC/;
return unless @{"${ic}::ISA"};
}
$ic->_init_implementor($scheme);
$implements{$scheme} = $ic;
$ic;
}
sub _init_implementor
{
my($class, $scheme) = @_;
# Remember that one implementor class may actually
# serve to implement several URI schemes.
}
sub clone
{
my $self = shift;
my $other = $$self;
bless \$other, ref $self;
}
sub _no_scheme_ok { 0 }
sub _scheme
{
my $self = shift;
unless (@_) {
return unless $$self =~ /^($scheme_re):/o;
return $1;
}
my $old;
my $new = shift;
if (defined($new) && length($new)) {
Carp::croak("Bad scheme '$new'") unless $new =~ /^$scheme_re$/o;
$old = $1 if $$self =~ s/^($scheme_re)://o;
my $newself = URI->new("$new:$$self");
$$self = $$newself;
bless $self, ref($newself);
}
else {
if ($self->_no_scheme_ok) {
$old = $1 if $$self =~ s/^($scheme_re)://o;
Carp::carp("Oops, opaque part now look like scheme")
if $^W && $$self =~ m/^$scheme_re:/o
}
else {
$old = $1 if $$self =~ m/^($scheme_re):/o;
}
}
return $old;
}
sub scheme
{
my $scheme = shift->_scheme(@_);
return unless defined $scheme;
lc($scheme);
}
sub opaque
{
my $self = shift;
unless (@_) {
$$self =~ /^(?:$scheme_re:)?([^\#]*)/o or die;
return $1;
}
$$self =~ /^($scheme_re:)? # optional scheme
([^\#]*) # opaque
(\#.*)? # optional fragment
$/sx or die;
my $old_scheme = $1;
my $old_opaque = $2;
my $old_frag = $3;
my $new_opaque = shift;
$new_opaque = "" unless defined $new_opaque;
$new_opaque =~ s/([^$uric])/ URI::Escape::escape_char($1)/ego;
$$self = defined($old_scheme) ? $old_scheme : "";
$$self .= $new_opaque;
$$self .= $old_frag if defined $old_frag;
$old_opaque;
}
*path = \&opaque; # alias
sub fragment
{
my $self = shift;
unless (@_) {
return unless $$self =~ /\#(.*)/s;
return $1;
}
my $old;
$old = $1 if $$self =~ s/\#(.*)//s;
my $new_frag = shift;
if (defined $new_frag) {
$new_frag =~ s/([^$uric])/ URI::Escape::escape_char($1) /ego;
$$self .= "#$new_frag";
}
$old;
}
sub as_string
{
my $self = shift;
$$self;
}
sub canonical
{
# Make sure scheme is lowercased, that we don't escape unreserved chars,
# and that we use upcase escape sequences.
my $self = shift;
my $scheme = $self->_scheme || "";
my $uc_scheme = $scheme =~ /[A-Z]/;
my $esc = $$self =~ /%[a-fA-F0-9]{2}/;
return $self unless $uc_scheme || $esc;
my $other = $self->clone;
if ($uc_scheme) {
$other->_scheme(lc $scheme);
}
if ($esc) {
$$other =~ s{%([0-9a-fA-F]{2})}
{ my $a = chr(hex($1));
$a =~ /^[$unreserved]\z/o ? $a : "%\U$1"
}ge;
}
return $other;
}
# Compare two URIs, subclasses will provide a more correct implementation
sub eq {
my($self, $other) = @_;
$self = URI->new($self, $other) unless ref $self;
$other = URI->new($other, $self) unless ref $other;
ref($self) eq ref($other) && # same class
$self->canonical->as_string eq $other->canonical->as_string;
}
# generic-URI transformation methods
sub abs { $_[0]; }
sub rel { $_[0]; }
# help out Storable
sub STORABLE_freeze {
my($self, $cloning) = @_;
return $$self;
}
sub STORABLE_thaw {
my($self, $cloning, $str) = @_;
$$self = $str;
}
1;
__END__
=head1 NAME
URI - Uniform Resource Identifiers (absolute and relative)
=head1 SYNOPSIS
$u1 = URI->new("http://www.perl.com");
$u2 = URI->new("foo", "http");
$u3 = $u2->abs($u1);
$u4 = $u3->clone;
$u5 = URI->new("HTTP://WWW.perl.com:80")->canonical;
$str = $u->as_string;
$str = "$u";
$scheme = $u->scheme;
$opaque = $u->opaque;
$path = $u->path;
$frag = $u->fragment;
$u->scheme("ftp");
$u->host("ftp.perl.com");
$u->path("cpan/");
=head1 DESCRIPTION
This module implements the C<URI> class. Objects of this class
represent "Uniform Resource Identifier references" as specified in RFC
2396 (and updated by RFC 2732).
A Uniform Resource Identifier is a compact string of characters that
identifies an abstract or physical resource. A Uniform Resource
Identifier can be further classified as either a Uniform Resource Locator
(URL) or a Uniform Resource Name (URN). The distinction between URL
and URN does not matter to the C<URI> class interface. A
"URI-reference" is a URI that may have additional information attached
in the form of a fragment identifier.
An absolute URI reference consists of three parts: a I<scheme>, a
I<scheme-specific part> and a I<fragment> identifier. A subset of URI
references share a common syntax for hierarchical namespaces. For
these, the scheme-specific part is further broken down into
I<authority>, I<path> and I<query> components. These URIs can also
take the form of relative URI references, where the scheme (and
usually also the authority) component is missing, but implied by the
context of the URI reference. The three forms of URI reference
syntax are summarized as follows:
<scheme>:<scheme-specific-part>#<fragment>
<scheme>://<authority><path>?<query>#<fragment>
<path>?<query>#<fragment>
The components into which a URI reference can be divided depend on the
I<scheme>. The C<URI> class provides methods to get and set the
individual components. The methods available for a specific
C<URI> object depend on the scheme.
=head1 CONSTRUCTORS
The following methods construct new C<URI> objects:
=over 4
=item $uri = URI->new( $str )
=item $uri = URI->new( $str, $scheme )
Constructs a new URI object. The string
representation of a URI is given as argument, together with an optional
scheme specification. Common URI wrappers like "" and <>, as well as
leading and trailing white space, are automatically removed from
the $str argument before it is processed further.
The constructor determines the scheme, maps this to an appropriate
URI subclass, constructs a new object of that class and returns it.
The $scheme argument is only used when $str is a
relative URI. It can be either a simple string that
denotes the scheme, a string containing an absolute URI reference, or
an absolute C<URI> object. If no $scheme is specified for a relative
URI $str, then $str is simply treated as a generic URI (no scheme-specific
methods available).
The set of characters available for building URI references is
restricted (see L<URI::Escape>). Characters outside this set are
automatically escaped by the URI constructor.
=item $uri = URI->new_abs( $str, $base_uri )
Constructs a new absolute URI object. The $str argument can
denote a relative or absolute URI. If relative, then it is
absolutized using $base_uri as base. The $base_uri must be an absolute
URI.
=item $uri = URI::file->new( $filename )
=item $uri = URI::file->new( $filename, $os )
Constructs a new I<file> URI from a file name. See L<URI::file>.
=item $uri = URI::file->new_abs( $filename )
=item $uri = URI::file->new_abs( $filename, $os )
Constructs a new absolute I<file> URI from a file name. See
L<URI::file>.
=item $uri = URI::file->cwd
Returns the current working directory as a I<file> URI. See
L<URI::file>.
=item $uri->clone
Returns a copy of the $uri.
=back
=head1 COMMON METHODS
The methods described in this section are available for all C<URI>
objects.
Methods that give access to components of a URI always return the
old value of the component. The value returned is C<undef> if the
component was not present. There is generally a difference between a
component that is empty (represented as C<"">) and a component that is
missing (represented as C<undef>). If an accessor method is given an
argument, it updates the corresponding component in addition to
returning the old value of the component. Passing an undefined
argument removes the component (if possible). The description of
each accessor method indicates whether the component is passed as
an escaped or an unescaped string. A component that can be further
divided into sub-parts are usually passed escaped, as unescaping might
change its semantics.
The common methods available for all URI are:
=over 4
=item $uri->scheme
=item $uri->scheme( $new_scheme )
Sets and returns the scheme part of the $uri. If the $uri is
relative, then $uri->scheme returns C<undef>. If called with an
argument, it updates the scheme of $uri, possibly changing the
class of $uri, and returns the old scheme value. The method croaks
if the new scheme name is illegal; a scheme name must begin with a
letter and must consist of only US-ASCII letters, numbers, and a few
special marks: ".", "+", "-". This restriction effectively means
that the scheme must be passed unescaped. Passing an undefined
argument to the scheme method makes the URI relative (if possible).
Letter case does not matter for scheme names. The string
returned by $uri->scheme is always lowercase. If you want the scheme
just as it was written in the URI in its original case,
you can use the $uri->_scheme method instead.
=item $uri->opaque
=item $uri->opaque( $new_opaque )
Sets and returns the scheme-specific part of the $uri
(everything between the scheme and the fragment)
as an escaped string.
=item $uri->path
=item $uri->path( $new_path )
Sets and returns the same value as $uri->opaque unless the URI
supports the generic syntax for hierarchical namespaces.
In that case the generic method is overridden to set and return
the part of the URI between the I<host name> and the I<fragment>.
=item $uri->fragment
=item $uri->fragment( $new_frag )
Returns the fragment identifier of a URI reference
as an escaped string.
=item $uri->as_string
Returns a URI object to a plain string. URI objects are
also converted to plain strings automatically by overloading. This
means that $uri objects can be used as plain strings in most Perl
constructs.
=item $uri->canonical
Returns a normalized version of the URI. The rules
for normalization are scheme-dependent. They usually involve
lowercasing the scheme and Internet host name components,
removing the explicit port specification if it matches the default port,
uppercasing all escape sequences, and unescaping octets that can be
better represented as plain characters.
For efficiency reasons, if the $uri is already in normalized form,
then a reference to it is returned instead of a copy.
=item $uri->eq( $other_uri )
=item URI::eq( $first_uri, $other_uri )
Tests whether two URI references are equal. URI references
that normalize to the same string are considered equal. The method
can also be used as a plain function which can also test two string
arguments.
If you need to test whether two C<URI> object references denote the
same object, use the '==' operator.
=item $uri->abs( $base_uri )
Returns an absolute URI reference. If $uri is already
absolute, then a reference to it is simply returned. If the $uri
is relative, then a new absolute URI is constructed by combining the
$uri and the $base_uri, and returned.
=item $uri->rel( $base_uri )
Returns a relative URI reference if it is possible to
make one that denotes the same resource relative to $base_uri.
If not, then $uri is simply returned.
=back
=head1 GENERIC METHODS
The following methods are available to schemes that use the
common/generic syntax for hierarchical namespaces. The descriptions of
schemes below indicate which these are. Unknown schemes are
assumed to support the generic syntax, and therefore the following
methods:
=over 4
=item $uri->authority
=item $uri->authority( $new_authority )
Sets and returns the escaped authority component
of the $uri.
=item $uri->path
=item $uri->path( $new_path )
Sets and returns the escaped path component of
the $uri (the part between the host name and the query or fragment).
The path can never be undefined, but it can be the empty string.
=item $uri->path_query
=item $uri->path_query( $new_path_query )
Sets and returns the escaped path and query
components as a single entity. The path and the query are
separated by a "?" character, but the query can itself contain "?".
=item $uri->path_segments
=item $uri->path_segments( $segment, ... )
Sets and returns the path. In a scalar context, it returns
the same value as $uri->path. In a list context, it returns the
unescaped path segments that make up the path. Path segments that
have parameters are returned as an anonymous array. The first element
is the unescaped path segment proper; subsequent elements are escaped
parameter strings. Such an anonymous array uses overloading so it can
be treated as a string too, but this string does not include the
parameters.
Note that absolute paths have the empty string as their first
I<path_segment>, i.e. the I<path> C</foo/bar> have 3
I<path_segments>; "", "foo" and "bar".
=item $uri->query
=item $uri->query( $new_query )
Sets and returns the escaped query component of
the $uri.
=item $uri->query_form
=item $uri->query_form( $key1 => $val1, $key2 => $val2, ... )
=item $uri->query_form( $key1 => $val1, $key2 => $val2, ..., $delim )
=item $uri->query_form( \@key_value_pairs )
=item $uri->query_form( \@key_value_pairs, $delim )
=item $uri->query_form( \%hash )
=item $uri->query_form( \%hash, $delim )
Sets and returns query components that use the
I<application/x-www-form-urlencoded> format. Key/value pairs are
separated by "&", and the key is separated from the value by a "="
character.
The form can be set either by passing separate key/value pairs, or via
an array or hash reference. Passing an empty array or an empty hash
removes the query component, whereas passing no arguments at all leaves
the component unchanged. The order of keys is undefined if a hash
reference is passed. The old value is always returned as a list of
separate key/value pairs. Assigning this list to a hash is unwise as
the keys returned might repeat.
The values passed when setting the form can be plain strings or
references to arrays of strings. Passing an array of values has the
same effect as passing the key repeatedly with one value at a time.
All the following statements have the same effect:
$uri->query_form(foo => 1, foo => 2);
$uri->query_form(foo => [1, 2]);
$uri->query_form([ foo => 1, foo => 2 ]);
$uri->query_form([ foo => [1, 2] ]);
$uri->query_form({ foo => [1, 2] });
The $delim parameter can be passed as ";" to force the key/value pairs
to be delimited by ";" instead of "&" in the query string. This
practice is often recommened for URLs embedded in HTML or XML
documents as this avoids the trouble of escaping the "&" character.
You might also set the $URI::DEFAULT_QUERY_FORM_DELIMITER variable to
";" for the same global effect.
The C<URI::QueryParam> module can be loaded to add further methods to
manipulate the form of a URI. See L<URI::QueryParam> for details.
=item $uri->query_keywords
=item $uri->query_keywords( $keywords, ... )
=item $uri->query_keywords( \@keywords )
Sets and returns query components that use the
keywords separated by "+" format.
The keywords can be set either by passing separate keywords directly
or by passing a reference to an array of keywords. Passing an empty
array removes the query component, whereas passing no arguments at
all leaves the component unchanged. The old value is always returned
as a list of separate words.
=back
=head1 SERVER METHODS
For schemes where the I<authority> component denotes an Internet host,
the following methods are available in addition to the generic
methods.
=over 4
=item $uri->userinfo
=item $uri->userinfo( $new_userinfo )
Sets and returns the escaped userinfo part of the
authority component.
For some schemes this is a user name and a password separated by
a colon. This practice is not recommended. Embedding passwords in
clear text (such as URI) has proven to be a security risk in almost
every case where it has been used.
=item $uri->host
=item $uri->host( $new_host )
Sets and returns the unescaped hostname.
If the $new_host string ends with a colon and a number, then this
number also sets the port.
=item $uri->port
=item $uri->port( $new_port )
Sets and returns the port. The port is a simple integer
that should be greater than 0.
If a port is not specified explicitly in the URI, then the URI scheme's default port
is returned. If you don't want the default port
substituted, then you can use the $uri->_port method instead.
=item $uri->host_port
=item $uri->host_port( $new_host_port )
Sets and returns the host and port as a single
unit. The returned value includes a port, even if it matches the
default port. The host part and the port part are separated by a
colon: ":".
=item $uri->default_port
Returns the default port of the URI scheme to which $uri
belongs. For I<http> this is the number 80, for I<ftp> this
is the number 21, etc. The default port for a scheme can not be
changed.
=back
=head1 SCHEME-SPECIFIC SUPPORT
Scheme-specific support is provided for the following URI schemes. For C<URI>
objects that do not belong to one of these, you can only use the common and
generic methods.
=over 4
=item B<data>:
The I<data> URI scheme is specified in RFC 2397. It allows inclusion
of small data items as "immediate" data, as if it had been included
externally.
C<URI> objects belonging to the data scheme support the common methods
and two new methods to access their scheme-specific components:
$uri->media_type and $uri->data. See L<URI::data> for details.
=item B<file>:
An old specification of the I<file> URI scheme is found in RFC 1738.
A new RFC 2396 based specification in not available yet, but file URI
references are in common use.
C<URI> objects belonging to the file scheme support the common and
generic methods. In addition, they provide two methods for mapping file URIs
back to local file names; $uri->file and $uri->dir. See L<URI::file>
for details.
=item B<ftp>:
An old specification of the I<ftp> URI scheme is found in RFC 1738. A
new RFC 2396 based specification in not available yet, but ftp URI
references are in common use.
C<URI> objects belonging to the ftp scheme support the common,
generic and server methods. In addition, they provide two methods for
accessing the userinfo sub-components: $uri->user and $uri->password.
=item B<gopher>:
The I<gopher> URI scheme is specified in
<draft-murali-url-gopher-1996-12-04> and will hopefully be available
as a RFC 2396 based specification.
C<URI> objects belonging to the gopher scheme support the common,
generic and server methods. In addition, they support some methods for
accessing gopher-specific path components: $uri->gopher_type,
$uri->selector, $uri->search, $uri->string.
=item B<http>:
The I<http> URI scheme is specified in RFC 2616.
The scheme is used to reference resources hosted by HTTP servers.
C<URI> objects belonging to the http scheme support the common,
generic and server methods.
=item B<https>:
The I<https> URI scheme is a Netscape invention which is commonly
implemented. The scheme is used to reference HTTP servers through SSL
connections. Its syntax is the same as http, but the default
port is different.
=item B<ldap>:
The I<ldap> URI scheme is specified in RFC 2255. LDAP is the
Lightweight Directory Access Protocol. An ldap URI describes an LDAP
search operation to perform to retrieve information from an LDAP
directory.
C<URI> objects belonging to the ldap scheme support the common,
generic and server methods as well as ldap-specific methods: $uri->dn,
$uri->attributes, $uri->scope, $uri->filter, $uri->extensions. See
L<URI::ldap> for details.
=item B<ldapi>:
Like the I<ldap> URI scheme, but uses a UNIX domain socket. The
server methods are not supported, and the local socket path is
available as $uri->un_path. The I<ldapi> scheme is used by the
OpenLDAP package. There is no real specification for it, but it is
mentioned in various OpenLDAP manual pages.
=item B<ldaps>:
Like the I<ldap> URI scheme, but uses an SSL connection. This
scheme is deprecated, as the preferred way is to use the I<start_tls>
mechanism.
=item B<mailto>:
The I<mailto> URI scheme is specified in RFC 2368. The scheme was
originally used to designate the Internet mailing address of an
individual or service. It has (in RFC 2368) been extended to allow
setting of other mail header fields and the message body.
C<URI> objects belonging to the mailto scheme support the common
methods and the generic query methods. In addition, they support the
following mailto-specific methods: $uri->to, $uri->headers.
=item B<mms>:
The I<mms> URL specification can be found at L<http://sdp.ppona.com/>
C<URI> objects belonging to the mms scheme support the common,
generic, and server methods, with the exception of userinfo and
query-related sub-components.
=item B<news>:
The I<news>, I<nntp> and I<snews> URI schemes are specified in
<draft-gilman-news-url-01> and will hopefully be available as an RFC
2396 based specification soon.
C<URI> objects belonging to the news scheme support the common,
generic and server methods. In addition, they provide some methods to
access the path: $uri->group and $uri->message.
=item B<nntp>:
See I<news> scheme.
=item B<pop>:
The I<pop> URI scheme is specified in RFC 2384. The scheme is used to
reference a POP3 mailbox.
C<URI> objects belonging to the pop scheme support the common, generic
and server methods. In addition, they provide two methods to access the
userinfo components: $uri->user and $uri->auth
=item B<rlogin>:
An old specification of the I<rlogin> URI scheme is found in RFC
1738. C<URI> objects belonging to the rlogin scheme support the
common, generic and server methods.
=item B<rtsp>:
The I<rtsp> URL specification can be found in section 3.2 of RFC 2326.
C<URI> objects belonging to the rtsp scheme support the common,
generic, and server methods, with the exception of userinfo and
query-related sub-components.
=item B<rtspu>:
The I<rtspu> URI scheme is used to talk to RTSP servers over UDP
instead of TCP. The syntax is the same as rtsp.
=item B<rsync>:
Information about rsync is available from http://rsync.samba.org.
C<URI> objects belonging to the rsync scheme support the common,
generic and server methods. In addition, they provide methods to
access the userinfo sub-components: $uri->user and $uri->password.
=item B<sip>:
The I<sip> URI specification is described in sections 19.1 and 25
of RFC 3261. C<URI> objects belonging to the sip scheme support the
common, generic, and server methods with the exception of path related
sub-components. In addition, they provide two methods to get and set
I<sip> parameters: $uri->params_form and $uri->params.
=item B<sips>:
See I<sip> scheme. Its syntax is the same as sip, but the default
port is different.
=item B<snews>:
See I<news> scheme. Its syntax is the same as news, but the default
port is different.
=item B<telnet>:
An old specification of the I<telnet> URI scheme is found in RFC
1738. C<URI> objects belonging to the telnet scheme support the
common, generic and server methods.
=item B<tn3270>:
These URIs are used like I<telnet> URIs but for connections to IBM
mainframes. C<URI> objects belonging to the tn3270 scheme support the
common, generic and server methods.
=item B<ssh>:
Information about ssh is available at http://www.openssh.com/.
C<URI> objects belonging to the ssh scheme support the common,
generic and server methods. In addition, they provide methods to
access the userinfo sub-components: $uri->user and $uri->password.
=item B<urn>:
The syntax of Uniform Resource Names is specified in RFC 2141. C<URI>
objects belonging to the urn scheme provide the common methods, and also the
methods $uri->nid and $uri->nss, which return the Namespace Identifier
and the Namespace-Specific String respectively.
The Namespace Identifier basically works like the Scheme identifier of
URIs, and further divides the URN namespace. Namespace Identifier
assignments are maintained at
<http://www.iana.org/assignments/urn-namespaces>.
Letter case is not significant for the Namespace Identifier. It is
always returned in lower case by the $uri->nid method. The $uri->_nid
method can be used if you want it in its original case.
=item B<urn>:B<isbn>:
The C<urn:isbn:> namespace contains International Standard Book
Numbers (ISBNs) and is described in RFC 3187. A C<URI> object belonging
to this namespace has the following extra methods (if the
Business::ISBN module is available): $uri->isbn,
$uri->isbn_publisher_code, $uri->isbn_group_code (formerly isbn_country_code,
which is still supported by issues a deprecation warning), $uri->isbn_as_ean.
=item B<urn>:B<oid>:
The C<urn:oid:> namespace contains Object Identifiers (OIDs) and is
described in RFC 3061. An object identifier consists of sequences of digits
separated by dots. A C<URI> object belonging to this namespace has an
additional method called $uri->oid that can be used to get/set the oid
value. In a list context, oid numbers are returned as separate elements.
=back
=head1 CONFIGURATION VARIABLES
The following configuration variables influence how the class and its
methods behave:
=over 4
=item $URI::ABS_ALLOW_RELATIVE_SCHEME
Some older parsers used to allow the scheme name to be present in the
relative URL if it was the same as the base URL scheme. RFC 2396 says
that this should be avoided, but you can enable this old behaviour by
setting the $URI::ABS_ALLOW_RELATIVE_SCHEME variable to a TRUE value.
The difference is demonstrated by the following examples:
URI->new("http:foo")->abs("http://host/a/b")
==> "http:foo"
local $URI::ABS_ALLOW_RELATIVE_SCHEME = 1;
URI->new("http:foo")->abs("http://host/a/b")
==> "http:/host/a/foo"
=item $URI::ABS_REMOTE_LEADING_DOTS
You can also have the abs() method ignore excess ".."
segments in the relative URI by setting $URI::ABS_REMOTE_LEADING_DOTS
to a TRUE value. The difference is demonstrated by the following
examples:
URI->new("../../../foo")->abs("http://host/a/b")
==> "http://host/../../foo"
local $URI::ABS_REMOTE_LEADING_DOTS = 1;
URI->new("../../../foo")->abs("http://host/a/b")
==> "http://host/foo"
=item $URI::DEFAULT_QUERY_FORM_DELIMITER
This value can be set to ";" to have the query form C<key=value> pairs
delimited by ";" instead of "&" which is the default.
=back
=head1 BUGS
Using regexp variables like $1 directly as arguments to the URI methods
does not work too well with current perl implementations. I would argue
that this is actually a bug in perl. The workaround is to quote
them. Example:
/(...)/ || die;
$u->query("$1");
=head1 PARSING URIs WITH REGEXP
As an alternative to this module, the following (official) regular
expression can be used to decode a URI:
my($scheme, $authority, $path, $query, $fragment) =
$uri =~ m|(?:([^:/?#]+):)?(?://([^/?#]*))?([^?#]*)(?:\?([^#]*))?(?:#(.*))?|;
The C<URI::Split> module provides the function uri_split() as a
readable alternative.
=head1 SEE ALSO
L<URI::file>, L<URI::WithBase>, L<URI::QueryParam>, L<URI::Escape>,
L<URI::Split>, L<URI::Heuristic>
RFC 2396: "Uniform Resource Identifiers (URI): Generic Syntax",
Berners-Lee, Fielding, Masinter, August 1998.
http://www.iana.org/assignments/uri-schemes
http://www.iana.org/assignments/urn-namespaces
http://www.w3.org/Addressing/
=head1 COPYRIGHT
Copyright 1995-2004,2008 Gisle Aas.
Copyright 1995 Martijn Koster.
This program is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
=head1 AUTHORS / ACKNOWLEDGMENTS
This module is based on the C<URI::URL> module, which in turn was
(distantly) based on the C<wwwurl.pl> code in the libwww-perl for
perl4 developed by Roy Fielding, as part of the Arcadia project at the
University of California, Irvine, with contributions from Brooks
Cutter.
C<URI::URL> was developed by Gisle Aas, Tim Bunce, Roy Fielding and
Martijn Koster with input from other people on the libwww-perl mailing
list.
C<URI> and related subclasses was developed by Gisle Aas.
=cut
You do not have the required permissions to view the files attached to this post.
Re: Netapp devices monitoring
Please run this command and let me know if it resolves it:
If it doesn't, please send the output of this command:
Code: Select all
cpan -i URI::EscapeCode: Select all
find / -name Escape.pm-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Netapp devices monitoring
Hello,
PFB the output:
[root@HO1-NAGIOSXI libexec]# cpan -i URI::Escape
Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/root/.cpan/Metadata'
Database was generated on Mon, 14 Sep 2020 13:29:03 GMT
CPAN: Time::HiRes loaded ok (v1.9758)
CPAN: HTTP::Tiny loaded ok (v0.074)
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/01mailrc.txt.gz
CPAN: YAML loaded ok (v1.24)
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/02packages.details.txt.gz
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Sun, 28 Feb 2021 03:29:02 GMT
CPAN: HTTP::Date loaded ok (v6.02)
.............
New CPAN.pm version (v2.28) available.
[Currently running version is v2.18]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
...............................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Running install for module 'URI::Escape'
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/O/OA/OAL ... .07.tar.gz
CPAN: Digest::SHA loaded ok (v6.02)
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/O/OA/OALDERS/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/O/OA/OALDERS/URI-5.07.tar.gz ok
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20181130)
Configuring O/OA/OALDERS/URI-5.07.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Test::Needs 0 not found.
Generating a Unix-style Makefile
Writing Makefile for URI
Writing MYMETA.yml and MYMETA.json
OALDERS/URI-5.07.tar.gz
/usr/bin/perl Makefile.PL -- OK
Running make for O/OA/OALDERS/URI-5.07.tar.gz
---- Unsatisfied dependencies detected during ----
---- OALDERS/URI-5.07.tar.gz ----
Test::Needs [build_requires]
Running install for module 'Test::Needs'
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/H/HA/HAA ... 006.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/H/HA/HAARG/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/H/HA/HAARG/Test-Needs-0.002006.tar.gz ok
Configuring H/HA/HAARG/Test-Needs-0.002006.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Test::Needs
Writing MYMETA.yml and MYMETA.json
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/perl Makefile.PL -- OK
Running make for H/HA/HAARG/Test-Needs-0.002006.tar.gz
cp lib/Test/Needs.pm blib/lib/Test/Needs.pm
Manifying 1 pod document
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/basic.t ......... ok
t/find_missing.t .. ok
All tests successful.
Files=2, Tests=137, 4 wallclock secs ( 0.04 usr 0.01 sys + 2.48 cusr 0.58 csys = 3.11 CPU)
Result: PASS
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/make test -- OK
Running make install
Manifying 1 pod document
Installing /usr/local/share/perl5/Test/Needs.pm
Installing /usr/local/share/man/man3/Test::Needs.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/make install -- OK
OALDERS/URI-5.07.tar.gz
Has already been unwrapped into directory /root/.cpan/build/URI-5.07-0
OALDERS/URI-5.07.tar.gz
Has already been prepared
Running make for O/OA/OALDERS/URI-5.07.tar.gz
cp lib/URI/ssh.pm blib/lib/URI/ssh.pm
cp lib/URI/rtsp.pm blib/lib/URI/rtsp.pm
cp lib/URI/_segment.pm blib/lib/URI/_segment.pm
cp lib/URI/Heuristic.pm blib/lib/URI/Heuristic.pm
cp lib/URI/urn/isbn.pm blib/lib/URI/urn/isbn.pm
cp lib/URI/sips.pm blib/lib/URI/sips.pm
cp lib/URI/IRI.pm blib/lib/URI/IRI.pm
cp lib/URI/news.pm blib/lib/URI/news.pm
cp lib/URI/_foreign.pm blib/lib/URI/_foreign.pm
cp lib/URI/QueryParam.pm blib/lib/URI/QueryParam.pm
cp lib/URI/file/FAT.pm blib/lib/URI/file/FAT.pm
cp lib/URI.pm blib/lib/URI.pm
cp lib/URI/ftp.pm blib/lib/URI/ftp.pm
cp lib/URI/file/Base.pm blib/lib/URI/file/Base.pm
cp lib/URI/ldaps.pm blib/lib/URI/ldaps.pm
cp lib/URI/_punycode.pm blib/lib/URI/_punycode.pm
cp lib/URI/rsync.pm blib/lib/URI/rsync.pm
cp lib/URI/file.pm blib/lib/URI/file.pm
cp lib/URI/sip.pm blib/lib/URI/sip.pm
cp lib/URI/_login.pm blib/lib/URI/_login.pm
cp lib/URI/http.pm blib/lib/URI/http.pm
cp lib/URI/WithBase.pm blib/lib/URI/WithBase.pm
cp lib/URI/rtspu.pm blib/lib/URI/rtspu.pm
cp lib/URI/_generic.pm blib/lib/URI/_generic.pm
cp lib/URI/file/Unix.pm blib/lib/URI/file/Unix.pm
cp lib/URI/URL.pm blib/lib/URI/URL.pm
cp lib/URI/_userpass.pm blib/lib/URI/_userpass.pm
cp lib/URI/urn/oid.pm blib/lib/URI/urn/oid.pm
cp lib/URI/ldap.pm blib/lib/URI/ldap.pm
cp lib/URI/file/OS2.pm blib/lib/URI/file/OS2.pm
cp lib/URI/Escape.pm blib/lib/URI/Escape.pm
cp lib/URI/snews.pm blib/lib/URI/snews.pm
cp lib/URI/_idna.pm blib/lib/URI/_idna.pm
cp lib/URI/pop.pm blib/lib/URI/pop.pm
cp lib/URI/_query.pm blib/lib/URI/_query.pm
cp lib/URI/ldapi.pm blib/lib/URI/ldapi.pm
cp lib/URI/rlogin.pm blib/lib/URI/rlogin.pm
cp lib/URI/gopher.pm blib/lib/URI/gopher.pm
cp lib/URI/_ldap.pm blib/lib/URI/_ldap.pm
cp lib/URI/file/Win32.pm blib/lib/URI/file/Win32.pm
cp lib/URI/nntp.pm blib/lib/URI/nntp.pm
cp lib/URI/mailto.pm blib/lib/URI/mailto.pm
cp lib/URI/data.pm blib/lib/URI/data.pm
cp lib/URI/_server.pm blib/lib/URI/_server.pm
cp lib/URI/file/QNX.pm blib/lib/URI/file/QNX.pm
cp lib/URI/mms.pm blib/lib/URI/mms.pm
cp lib/URI/Split.pm blib/lib/URI/Split.pm
cp lib/URI/urn.pm blib/lib/URI/urn.pm
cp lib/URI/telnet.pm blib/lib/URI/telnet.pm
cp lib/URI/tn3270.pm blib/lib/URI/tn3270.pm
cp lib/URI/sftp.pm blib/lib/URI/sftp.pm
cp lib/URI/https.pm blib/lib/URI/https.pm
cp lib/URI/file/Mac.pm blib/lib/URI/file/Mac.pm
Manifying 11 pod documents
OALDERS/URI-5.07.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-report-prereqs.t ..... #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker any 7.34
#
# === Configure Suggests ===
#
# Module Want Have
# -------- ------- -------
# JSON::PP 2.27300 2.97001
#
# === Build Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker any 7.34
#
# === Test Requires ===
#
# Module Want Have
# --------------------- ---- --------
# ExtUtils::MakeMaker any 7.34
# File::Spec any 3.74
# File::Spec::Functions any 3.74
# File::Temp any 0.2306
# Test any 1.0
# Test::More 0.96 1.302135
# Test::Needs any 0.002006
# utf8 any 1.19
#
# === Test Recommends ===
#
# Module Want Have
# ---------- -------- --------
# CPAN::Meta 2.120900 2.150010
#
# === Runtime Requires ===
#
# Module Want Have
# ------------ ---- -----
# Carp any 1.42
# Cwd any 3.74
# Data::Dumper any 2.167
# Encode any 2.97
# Exporter 5.57 5.72
# MIME::Base64 2 3.15
# Net::Domain any 3.11
# Scalar::Util any 1.49
# constant any 1.33
# integer any 1.01
# overload any 1.28
# parent any 0.237
# strict any 1.11
# utf8 any 1.19
# warnings any 1.37
#
t/00-report-prereqs.t ..... ok
t/abs.t ................... ok
t/clone.t ................. ok
t/cwd.t ................... ok
t/data.t .................. ok
t/escape-char.t ........... ok
t/escape.t ................ ok
t/file.t .................. ok
t/ftp.t ................... ok
t/generic.t ............... ok
t/gopher.t ................ ok
t/heuristic.t ............. ok
t/http.t .................. ok
t/idna.t .................. ok
t/ipv6.t .................. ok
t/iri.t ................... ok
t/ldap.t .................. ok
t/mailto.t ................ ok
t/mix.t ................... ok
t/mms.t ................... ok
t/news.t .................. ok
t/num_eq.t ................ ok
t/old-absconf.t ........... ok
t/old-base.t .............. ok
t/old-file.t .............. ok
t/old-relbase.t ........... ok
t/path-segments.t ......... ok
t/pop.t ................... ok
t/punycode.t .............. ok
t/query-param.t ........... ok
t/query.t ................. ok
t/rel.t ................... ok
t/rfc2732.t ............... ok
t/roy-test.t .............. syntax error at t/roy-test.t line 5, near "plan tests"
BEGIN not safe after errors--compilation aborted at t/roy-test.t line 7.
t/roy-test.t .............. Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
t/rsync.t ................. ok
t/rtsp.t .................. ok
t/scheme-exceptions.t ..... ok
t/sip.t ................... ok
t/sort-hash-query-form.t .. ok
t/split.t ................. ok
t/storable.t .............. ok
t/urn-isbn.t .............. skipped: Need Business::ISBN
t/urn-oid.t ............... ok
t/utf8.t .................. ok
Test Summary Report
-------------------
t/roy-test.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=44, Tests=525, 8 wallclock secs ( 0.17 usr 0.06 sys + 1.82 cusr 0.35 csys = 2.40 CPU)
Result: FAIL
Failed 1/44 test programs. 0/525 subtests failed.
make: *** [Makefile:975: test_dynamic] Error 255
OALDERS/URI-5.07.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports OALDERS/URI-5.07.tar.gz
===================================
[root@HO1-NAGIOSXI ~]# find / -name Escape.pm
find: ‘/proc/40797’: No such file or directory
find: ‘/proc/40808’: No such file or directory
find: ‘/proc/40817’: No such file or directory
find: ‘/proc/42376’: No such file or directory
find: ‘/proc/63830’: No such file or directory
/usr/lib64/perl5/URI/Escape.pm
/usr/share/perl5/URI/Escape.pm
/root/.cpan/build/URI-5.07-0/lib/URI/Escape.pm
/root/.cpan/build/URI-5.07-0/blib/lib/URI/Escape.pm
/tmp/Escape.pm
[root@HO1-NAGIOSXI ~]#
PFB the output:
[root@HO1-NAGIOSXI libexec]# cpan -i URI::Escape
Loading internal null logger. Install Log::Log4perl for logging messages
Reading '/root/.cpan/Metadata'
Database was generated on Mon, 14 Sep 2020 13:29:03 GMT
CPAN: Time::HiRes loaded ok (v1.9758)
CPAN: HTTP::Tiny loaded ok (v0.074)
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/01mailrc.txt.gz
CPAN: YAML loaded ok (v1.24)
Reading '/root/.cpan/sources/authors/01mailrc.txt.gz'
............................................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/02packages.details.txt.gz
Reading '/root/.cpan/sources/modules/02packages.details.txt.gz'
Database was generated on Sun, 28 Feb 2021 03:29:02 GMT
CPAN: HTTP::Date loaded ok (v6.02)
.............
New CPAN.pm version (v2.28) available.
[Currently running version is v2.18]
You might want to try
install CPAN
reload cpan
to both upgrade CPAN.pm and run the new version without leaving
the current session.
...............................................................DONE
Fetching with HTTP::Tiny:
http://www.cpan.org/modules/03modlist.data.gz
Reading '/root/.cpan/sources/modules/03modlist.data.gz'
DONE
Writing /root/.cpan/Metadata
Running install for module 'URI::Escape'
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/O/OA/OAL ... .07.tar.gz
CPAN: Digest::SHA loaded ok (v6.02)
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/O/OA/OALDERS/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/O/OA/OALDERS/URI-5.07.tar.gz ok
CPAN: CPAN::Meta::Requirements loaded ok (v2.140)
CPAN: Parse::CPAN::Meta loaded ok (v2.150010)
CPAN: CPAN::Meta loaded ok (v2.150010)
CPAN: Module::CoreList loaded ok (v5.20181130)
Configuring O/OA/OALDERS/URI-5.07.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Warning: prerequisite Test::Needs 0 not found.
Generating a Unix-style Makefile
Writing Makefile for URI
Writing MYMETA.yml and MYMETA.json
OALDERS/URI-5.07.tar.gz
/usr/bin/perl Makefile.PL -- OK
Running make for O/OA/OALDERS/URI-5.07.tar.gz
---- Unsatisfied dependencies detected during ----
---- OALDERS/URI-5.07.tar.gz ----
Test::Needs [build_requires]
Running install for module 'Test::Needs'
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/H/HA/HAA ... 006.tar.gz
Fetching with HTTP::Tiny:
http://www.cpan.org/authors/id/H/HA/HAARG/CHECKSUMS
Checksum for /root/.cpan/sources/authors/id/H/HA/HAARG/Test-Needs-0.002006.tar.gz ok
Configuring H/HA/HAARG/Test-Needs-0.002006.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for Test::Needs
Writing MYMETA.yml and MYMETA.json
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/perl Makefile.PL -- OK
Running make for H/HA/HAARG/Test-Needs-0.002006.tar.gz
cp lib/Test/Needs.pm blib/lib/Test/Needs.pm
Manifying 1 pod document
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/basic.t ......... ok
t/find_missing.t .. ok
All tests successful.
Files=2, Tests=137, 4 wallclock secs ( 0.04 usr 0.01 sys + 2.48 cusr 0.58 csys = 3.11 CPU)
Result: PASS
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/make test -- OK
Running make install
Manifying 1 pod document
Installing /usr/local/share/perl5/Test/Needs.pm
Installing /usr/local/share/man/man3/Test::Needs.3pm
Appending installation info to /usr/lib64/perl5/perllocal.pod
HAARG/Test-Needs-0.002006.tar.gz
/usr/bin/make install -- OK
OALDERS/URI-5.07.tar.gz
Has already been unwrapped into directory /root/.cpan/build/URI-5.07-0
OALDERS/URI-5.07.tar.gz
Has already been prepared
Running make for O/OA/OALDERS/URI-5.07.tar.gz
cp lib/URI/ssh.pm blib/lib/URI/ssh.pm
cp lib/URI/rtsp.pm blib/lib/URI/rtsp.pm
cp lib/URI/_segment.pm blib/lib/URI/_segment.pm
cp lib/URI/Heuristic.pm blib/lib/URI/Heuristic.pm
cp lib/URI/urn/isbn.pm blib/lib/URI/urn/isbn.pm
cp lib/URI/sips.pm blib/lib/URI/sips.pm
cp lib/URI/IRI.pm blib/lib/URI/IRI.pm
cp lib/URI/news.pm blib/lib/URI/news.pm
cp lib/URI/_foreign.pm blib/lib/URI/_foreign.pm
cp lib/URI/QueryParam.pm blib/lib/URI/QueryParam.pm
cp lib/URI/file/FAT.pm blib/lib/URI/file/FAT.pm
cp lib/URI.pm blib/lib/URI.pm
cp lib/URI/ftp.pm blib/lib/URI/ftp.pm
cp lib/URI/file/Base.pm blib/lib/URI/file/Base.pm
cp lib/URI/ldaps.pm blib/lib/URI/ldaps.pm
cp lib/URI/_punycode.pm blib/lib/URI/_punycode.pm
cp lib/URI/rsync.pm blib/lib/URI/rsync.pm
cp lib/URI/file.pm blib/lib/URI/file.pm
cp lib/URI/sip.pm blib/lib/URI/sip.pm
cp lib/URI/_login.pm blib/lib/URI/_login.pm
cp lib/URI/http.pm blib/lib/URI/http.pm
cp lib/URI/WithBase.pm blib/lib/URI/WithBase.pm
cp lib/URI/rtspu.pm blib/lib/URI/rtspu.pm
cp lib/URI/_generic.pm blib/lib/URI/_generic.pm
cp lib/URI/file/Unix.pm blib/lib/URI/file/Unix.pm
cp lib/URI/URL.pm blib/lib/URI/URL.pm
cp lib/URI/_userpass.pm blib/lib/URI/_userpass.pm
cp lib/URI/urn/oid.pm blib/lib/URI/urn/oid.pm
cp lib/URI/ldap.pm blib/lib/URI/ldap.pm
cp lib/URI/file/OS2.pm blib/lib/URI/file/OS2.pm
cp lib/URI/Escape.pm blib/lib/URI/Escape.pm
cp lib/URI/snews.pm blib/lib/URI/snews.pm
cp lib/URI/_idna.pm blib/lib/URI/_idna.pm
cp lib/URI/pop.pm blib/lib/URI/pop.pm
cp lib/URI/_query.pm blib/lib/URI/_query.pm
cp lib/URI/ldapi.pm blib/lib/URI/ldapi.pm
cp lib/URI/rlogin.pm blib/lib/URI/rlogin.pm
cp lib/URI/gopher.pm blib/lib/URI/gopher.pm
cp lib/URI/_ldap.pm blib/lib/URI/_ldap.pm
cp lib/URI/file/Win32.pm blib/lib/URI/file/Win32.pm
cp lib/URI/nntp.pm blib/lib/URI/nntp.pm
cp lib/URI/mailto.pm blib/lib/URI/mailto.pm
cp lib/URI/data.pm blib/lib/URI/data.pm
cp lib/URI/_server.pm blib/lib/URI/_server.pm
cp lib/URI/file/QNX.pm blib/lib/URI/file/QNX.pm
cp lib/URI/mms.pm blib/lib/URI/mms.pm
cp lib/URI/Split.pm blib/lib/URI/Split.pm
cp lib/URI/urn.pm blib/lib/URI/urn.pm
cp lib/URI/telnet.pm blib/lib/URI/telnet.pm
cp lib/URI/tn3270.pm blib/lib/URI/tn3270.pm
cp lib/URI/sftp.pm blib/lib/URI/sftp.pm
cp lib/URI/https.pm blib/lib/URI/https.pm
cp lib/URI/file/Mac.pm blib/lib/URI/file/Mac.pm
Manifying 11 pod documents
OALDERS/URI-5.07.tar.gz
/usr/bin/make -- OK
Running make test
PERL_DL_NONLAZY=1 "/usr/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00-report-prereqs.t ..... #
# Versions for all modules listed in MYMETA.json (including optional ones):
#
# === Configure Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker any 7.34
#
# === Configure Suggests ===
#
# Module Want Have
# -------- ------- -------
# JSON::PP 2.27300 2.97001
#
# === Build Requires ===
#
# Module Want Have
# ------------------- ---- ----
# ExtUtils::MakeMaker any 7.34
#
# === Test Requires ===
#
# Module Want Have
# --------------------- ---- --------
# ExtUtils::MakeMaker any 7.34
# File::Spec any 3.74
# File::Spec::Functions any 3.74
# File::Temp any 0.2306
# Test any 1.0
# Test::More 0.96 1.302135
# Test::Needs any 0.002006
# utf8 any 1.19
#
# === Test Recommends ===
#
# Module Want Have
# ---------- -------- --------
# CPAN::Meta 2.120900 2.150010
#
# === Runtime Requires ===
#
# Module Want Have
# ------------ ---- -----
# Carp any 1.42
# Cwd any 3.74
# Data::Dumper any 2.167
# Encode any 2.97
# Exporter 5.57 5.72
# MIME::Base64 2 3.15
# Net::Domain any 3.11
# Scalar::Util any 1.49
# constant any 1.33
# integer any 1.01
# overload any 1.28
# parent any 0.237
# strict any 1.11
# utf8 any 1.19
# warnings any 1.37
#
t/00-report-prereqs.t ..... ok
t/abs.t ................... ok
t/clone.t ................. ok
t/cwd.t ................... ok
t/data.t .................. ok
t/escape-char.t ........... ok
t/escape.t ................ ok
t/file.t .................. ok
t/ftp.t ................... ok
t/generic.t ............... ok
t/gopher.t ................ ok
t/heuristic.t ............. ok
t/http.t .................. ok
t/idna.t .................. ok
t/ipv6.t .................. ok
t/iri.t ................... ok
t/ldap.t .................. ok
t/mailto.t ................ ok
t/mix.t ................... ok
t/mms.t ................... ok
t/news.t .................. ok
t/num_eq.t ................ ok
t/old-absconf.t ........... ok
t/old-base.t .............. ok
t/old-file.t .............. ok
t/old-relbase.t ........... ok
t/path-segments.t ......... ok
t/pop.t ................... ok
t/punycode.t .............. ok
t/query-param.t ........... ok
t/query.t ................. ok
t/rel.t ................... ok
t/rfc2732.t ............... ok
t/roy-test.t .............. syntax error at t/roy-test.t line 5, near "plan tests"
BEGIN not safe after errors--compilation aborted at t/roy-test.t line 7.
t/roy-test.t .............. Dubious, test returned 255 (wstat 65280, 0xff00)
No subtests run
t/rsync.t ................. ok
t/rtsp.t .................. ok
t/scheme-exceptions.t ..... ok
t/sip.t ................... ok
t/sort-hash-query-form.t .. ok
t/split.t ................. ok
t/storable.t .............. ok
t/urn-isbn.t .............. skipped: Need Business::ISBN
t/urn-oid.t ............... ok
t/utf8.t .................. ok
Test Summary Report
-------------------
t/roy-test.t (Wstat: 65280 Tests: 0 Failed: 0)
Non-zero exit status: 255
Parse errors: No plan found in TAP output
Files=44, Tests=525, 8 wallclock secs ( 0.17 usr 0.06 sys + 1.82 cusr 0.35 csys = 2.40 CPU)
Result: FAIL
Failed 1/44 test programs. 0/525 subtests failed.
make: *** [Makefile:975: test_dynamic] Error 255
OALDERS/URI-5.07.tar.gz
/usr/bin/make test -- NOT OK
//hint// to see the cpan-testers results for installing this module, try:
reports OALDERS/URI-5.07.tar.gz
===================================
[root@HO1-NAGIOSXI ~]# find / -name Escape.pm
find: ‘/proc/40797’: No such file or directory
find: ‘/proc/40808’: No such file or directory
find: ‘/proc/40817’: No such file or directory
find: ‘/proc/42376’: No such file or directory
find: ‘/proc/63830’: No such file or directory
/usr/lib64/perl5/URI/Escape.pm
/usr/share/perl5/URI/Escape.pm
/root/.cpan/build/URI-5.07-0/lib/URI/Escape.pm
/root/.cpan/build/URI-5.07-0/blib/lib/URI/Escape.pm
/tmp/Escape.pm
[root@HO1-NAGIOSXI ~]#
Re: Netapp devices monitoring
Please try renaming this temporarily:
Then test again.
If anything breaks, rename it back:
Code: Select all
mv /usr/lib64/perl5/URI/Escape.pm /usr/lib64/perl5/URI/EscapeOLD.pmIf anything breaks, rename it back:
Code: Select all
mv /usr/lib64/perl5/URI/EscapeOLD.pm /usr/lib64/perl5/URI/Escape.pm-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Netapp devices monitoring
Hello,
After renaming, it seems to be working, I checked below:
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -h
Option h requires an argument
A required option is not set!
check_netapp_ontapi version: v3.01.171611
By John Murphy <[email protected]>, Willem D'Haese <[email protected]>, GNU GPL License
Usage: ./check_netapp_ontapi.pl -H <hostname> -u <username> -p <password> -o <option> [ -w <warning_thresh> -c <critical_thresh> -m <include|exclude,pattern1,pattern2,etc> ]
--hostname, -H
Hostname or address of the cluster administrative interface.
--node, -n
Name of a vhost or cluster-node to restrict this query to.
--user, -u
Username of a Netapp Ontapi enabled user.
--password, -p
Password for the netapp Ontapi enabled user.
--option, -o
The name of the option you want to check. See the option and threshold list at the bottom of this help text.
--suboption, -s
If available for the option, allow to specify the list of the checks to perform.
--warning, -w
A custom warning threshold value. See the option and threshold list at the bottom of this help text.
--critical, -c
A custom warning threshold value. See the option and threshold list at the bottom of this help text.
--modifier, -m
This modifier is used to set an inclusive or exclusive filter on what you want to monitor.
--report, -r
The output format. Can be "short", "long" (default), or "html"
--verbose, --debug, --trace
Debug output options
--help, -h
Display this help text.
===OPTION LIST===
volume_health
desc: Check the space and inode health of a vServer volume. If space % and space in *B are both defined the smaller value of the two will be used when deciding if the volume is in a warning or critical state. This allows you to better accomodate large volume monitoring. Separate values with comma.
thresh: Space % used, space in *B (i.e MB) remaining, inode count remaining, inode % used (Usage example: 80%i), "offline" keyword.
node: The node option restricts this check by vserver name.
aggregate_health
desc: Check the space and inode health of a cluster aggregate. If space % and space in *B are both defined the smaller value of the two will be used when deciding if the volume is in a warning or critical state. This allows you to better accomodate large aggregate monitoring. Separate values with comma.
thresh: Space % used, space in *B (i.e MB) remaining, inode count remaining, inode % used (Usage example: 80%i), "offline" keyword, "is-home" keyword.
node: The node option restricts this check by cluster-node name.
snapshot_health
desc: Check the space and inode health of a vServer snapshot. If space % and space in *B are both defined the smaller value of the two will be used when deciding if the volume is in a warning or critical state. This allows you to better accomodate large snapshot monitoring. Separate values with comma.
thresh: Space % used, space in *B (i.e MB) remaining, inode count remaining, inode % used (Usage example: 80%i), "offline" keyword.
node: The node option restricts this check by vserver name.
quota_health
desc: Check that the space and file thresholds have not been crossed on a quota.
thresh: N/A storage defined.
node: The node option restricts this check by vserver name.
snapmirror_health
desc: Check the lag time and health flag of the snapmirror relationships.
thresh: Snapmirror lag time (valid intervals are s, m, h, d).
node: The node options restricts this check by snapmirror destination cluster-node name.
filer_hardware_health
desc: Check the environment hardware health of the filers (fan, psu, temperature, battery).
thresh: Component name (fan, psu, temperature, battery). There is no default alert level they MUST be defined.
node: The node option restricts this check by cluster-node name.
port_health
desc: Checks the state of a physical network port.
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
vscan_health
desc: Check if vscan is disabled
thresh: N/A not customizable.
node: The node option restricts this check by vserver name.
interface_health
desc: Check that a LIF is in the correctly configured state and that it is on its home node and port.
thresh: N/A not customizable.
node: The node option restricts this check by vserver name.
suboption: status, home-node, home-port
netapp_alarms
desc: Check for Netapp console alarms.
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
(This is not available in ONTAP > 9)
cluster_health
desc: Check the cluster disks for failure or other potentially undesirable states.
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
clusternode_health
desc: Check the cluster-nodes for unhealthy conditions
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
disk_health
desc: Check the health of the disks in the cluster.
thresh: Not customizable yet.
node: The node option restricts this check by cluster-node name.
disk_spare
desc: Check the number of spare disks
thresh: Warning / critical required spare disks. Default thresholds are 2 / 1.
node: The node option restricts this check by cluster-node name.
* For keyword thresholds, if you want to ignore alerts for that particular keyword you set it at the same threshold that the alert defaults to.
When I am testing for a storage device, getting error as :
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.19.0.21 -u sachin.gangurde -p ******** -o volume_health
Failed test query: Server returned HTTP Error:
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.19.0.21 -u sachin.gangurde -p ****** -o quota_health
Failed test query: Server returned HTTP Error:
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]#
Please suggest.
After renaming, it seems to be working, I checked below:
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -h
Option h requires an argument
A required option is not set!
check_netapp_ontapi version: v3.01.171611
By John Murphy <[email protected]>, Willem D'Haese <[email protected]>, GNU GPL License
Usage: ./check_netapp_ontapi.pl -H <hostname> -u <username> -p <password> -o <option> [ -w <warning_thresh> -c <critical_thresh> -m <include|exclude,pattern1,pattern2,etc> ]
--hostname, -H
Hostname or address of the cluster administrative interface.
--node, -n
Name of a vhost or cluster-node to restrict this query to.
--user, -u
Username of a Netapp Ontapi enabled user.
--password, -p
Password for the netapp Ontapi enabled user.
--option, -o
The name of the option you want to check. See the option and threshold list at the bottom of this help text.
--suboption, -s
If available for the option, allow to specify the list of the checks to perform.
--warning, -w
A custom warning threshold value. See the option and threshold list at the bottom of this help text.
--critical, -c
A custom warning threshold value. See the option and threshold list at the bottom of this help text.
--modifier, -m
This modifier is used to set an inclusive or exclusive filter on what you want to monitor.
--report, -r
The output format. Can be "short", "long" (default), or "html"
--verbose, --debug, --trace
Debug output options
--help, -h
Display this help text.
===OPTION LIST===
volume_health
desc: Check the space and inode health of a vServer volume. If space % and space in *B are both defined the smaller value of the two will be used when deciding if the volume is in a warning or critical state. This allows you to better accomodate large volume monitoring. Separate values with comma.
thresh: Space % used, space in *B (i.e MB) remaining, inode count remaining, inode % used (Usage example: 80%i), "offline" keyword.
node: The node option restricts this check by vserver name.
aggregate_health
desc: Check the space and inode health of a cluster aggregate. If space % and space in *B are both defined the smaller value of the two will be used when deciding if the volume is in a warning or critical state. This allows you to better accomodate large aggregate monitoring. Separate values with comma.
thresh: Space % used, space in *B (i.e MB) remaining, inode count remaining, inode % used (Usage example: 80%i), "offline" keyword, "is-home" keyword.
node: The node option restricts this check by cluster-node name.
snapshot_health
desc: Check the space and inode health of a vServer snapshot. If space % and space in *B are both defined the smaller value of the two will be used when deciding if the volume is in a warning or critical state. This allows you to better accomodate large snapshot monitoring. Separate values with comma.
thresh: Space % used, space in *B (i.e MB) remaining, inode count remaining, inode % used (Usage example: 80%i), "offline" keyword.
node: The node option restricts this check by vserver name.
quota_health
desc: Check that the space and file thresholds have not been crossed on a quota.
thresh: N/A storage defined.
node: The node option restricts this check by vserver name.
snapmirror_health
desc: Check the lag time and health flag of the snapmirror relationships.
thresh: Snapmirror lag time (valid intervals are s, m, h, d).
node: The node options restricts this check by snapmirror destination cluster-node name.
filer_hardware_health
desc: Check the environment hardware health of the filers (fan, psu, temperature, battery).
thresh: Component name (fan, psu, temperature, battery). There is no default alert level they MUST be defined.
node: The node option restricts this check by cluster-node name.
port_health
desc: Checks the state of a physical network port.
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
vscan_health
desc: Check if vscan is disabled
thresh: N/A not customizable.
node: The node option restricts this check by vserver name.
interface_health
desc: Check that a LIF is in the correctly configured state and that it is on its home node and port.
thresh: N/A not customizable.
node: The node option restricts this check by vserver name.
suboption: status, home-node, home-port
netapp_alarms
desc: Check for Netapp console alarms.
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
(This is not available in ONTAP > 9)
cluster_health
desc: Check the cluster disks for failure or other potentially undesirable states.
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
clusternode_health
desc: Check the cluster-nodes for unhealthy conditions
thresh: N/A not customizable.
node: The node option restricts this check by cluster-node name.
disk_health
desc: Check the health of the disks in the cluster.
thresh: Not customizable yet.
node: The node option restricts this check by cluster-node name.
disk_spare
desc: Check the number of spare disks
thresh: Warning / critical required spare disks. Default thresholds are 2 / 1.
node: The node option restricts this check by cluster-node name.
* For keyword thresholds, if you want to ignore alerts for that particular keyword you set it at the same threshold that the alert defaults to.
When I am testing for a storage device, getting error as :
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.19.0.21 -u sachin.gangurde -p ******** -o volume_health
Failed test query: Server returned HTTP Error:
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.19.0.21 -u sachin.gangurde -p ****** -o quota_health
Failed test query: Server returned HTTP Error:
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]#
Please suggest.
-
benjaminsmith
- Posts: 5324
- Joined: Wed Aug 22, 2018 4:39 pm
- Location: saint paul
Re: Netapp devices monitoring
Hi,
What about the other options? Are you getting that error across all of them. Try running the plugin from the CLI, but this time use the debug or verbose mode to see if we can get some more data from the plugin?
Thanks,
Benjamin
What about the other options? Are you getting that error across all of them. Try running the plugin from the CLI, but this time use the debug or verbose mode to see if we can get some more data from the plugin?
Thanks,
Benjamin
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
kalyanpabolu
- Posts: 246
- Joined: Fri Jul 03, 2020 4:18 am
Re: Netapp devices monitoring
Hello,
The plugin is working fine for some of the NetApp devices (NetApp 7-mode & Santricity array’s ) but it is giving error for others. I checked the devices are reachable from Nagios. PFB details for your information:
[root@HO1-NAGIOSXI libexec]# ping 10.1.0.221
PING 10.1.0.221 (10.1.0.221) 56(84) bytes of data.
64 bytes from 10.1.0.221: icmp_seq=1 ttl=64 time=0.208 ms
64 bytes from 10.1.0.221: icmp_seq=2 ttl=64 time=0.200 ms
64 bytes from 10.1.0.221: icmp_seq=3 ttl=64 time=0.223 ms
64 bytes from 10.1.0.221: icmp_seq=4 ttl=64 time=0.170 ms
64 bytes from 10.1.0.221: icmp_seq=5 ttl=64 time=0.208 ms
^C
--- 10.1.0.221 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 41ms
rtt min/avg/max/mdev = 0.170/0.201/0.223/0.025 ms
[root@HO1-NAGIOSXI libexec]#
But we can see the error as:
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.221 -u jayakrishna.v -p Dubai2020 -o volume_health
Failed test query: in Zapi::invoke, cannot connect to socket
[root@HO1-NAGIOSXI libexec]#
Other IP is:
[root@HO1-NAGIOSXI libexec]# ping 10.1.0.29
PING 10.1.0.29 (10.1.0.29) 56(84) bytes of data.
64 bytes from 10.1.0.29: icmp_seq=1 ttl=128 time=0.217 ms
64 bytes from 10.1.0.29: icmp_seq=2 ttl=128 time=0.126 ms
64 bytes from 10.1.0.29: icmp_seq=3 ttl=128 time=0.164 ms
64 bytes from 10.1.0.29: icmp_seq=4 ttl=128 time=0.196 ms
^C
--- 10.1.0.29 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 33ms
rtt min/avg/max/mdev = 0.126/0.175/0.217/0.038 ms
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.29 -u jayakrishna.v -p Dubai2020 -o volume_health
Failed test query: in Zapi::invoke, cannot connect to socket
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 172.16.10.5 -u jayakrishna.v -p Dubai2020 -o filer_hardware_health
Failed test query: Server returned HTTP Error:
[root@HO1-NAGIOSXI libexec]#
Below is the one where we can see it is working perfectly fine.
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.233 -u jayakrishna.v -p Dubai2020 -o volume_health
SANSVM/Vol_FAS2750_SATA2 - 2.02TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SATA6 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SATA8 - 2.01TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SATA3 - 2.34TB/2.70TB (87%) SPACE USED, SANSVM/Vol_FAS2750_SATA7 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SATA9 - 2.02TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SAS3 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SATA1 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SAS4 - 2.33TB/2.70TB (86%) SPACE USED, SANSVM/Vol_FAS2750_SATA5 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SAS6 - 2.02TB/2.50TB (81%) SPACE USED, SANSVM/Vol_FAS2750_SAS2 - 2.02TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SAS1 - 2.04TB/2.50TB (81%) SPACE USED, SANSVM/Vol_FAS2750_SAS5 - 2.34TB/2.70TB (87%) SPACE USED
| 'SANSVM/Vol_FAS2750_SATA9_usage'=2219111960576B;;;0;2638827909120 'SANSVM/Lun_HO1_COMMVAULT1_usage'=1066706034688B;;;0;2199023255552 'SANSVM/Vol_FAS2750_SATA1_usage'=2230700564480B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA3_usage'=2569660665856B;;;0;2968681398272 'SANSVM/Vol_FAS2750_SAS5_usage'=2574528737280B;;;0;2968681398272 'SANSVM/Vol_FAS2750_SAS3_usage'=2235830239232B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA2_usage'=2217813024768B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA6_usage'=2232081240064B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA5_usage'=2231548436480B;;;0;2638827909120 'SANSVM/Lun_HO1_COMMVAULT_usage'=10281132032B;;;0;214748364800 'SANSVM/vol_FILESRV2_3D_usage'=2277659054080B;;;0;4398046511104 'SANSVM/Vol_FAS2750_SATA4_usage'=2685575364608B;;;0;109951162830848 'SANSVM/Vol_FAS2750_SATA8_usage'=2213347049472B;;;0;2638827909120 'SANSVM/vol_FILESRV2_REAL_usage'=592866197504B;;;0;1099511627776 'HO1-FAS2750-2/vol0_usage'=49291603968B;;;0;154325098496 'SANSVM/Vol_FAS2750_SAS6_usage'=2219019354112B;;;0;2748779069440 'SANSVM/Vol_FAS2750_SATA7_usage'=2233722609664B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SAS4_usage'=2557812695040B;;;0;2968681398272 'SANSVM/vol_FILESERVER1_MCTBDD_usage'=914895663104B;;;0;1649267441664 'SANSVM/Lun_FAS2750_Test_usage'=92696576B;;;0;53687091200 'SANSVM/vol_FILESRV2_HR_usage'=147512463360B;;;0;429496729600 'SANSVM/Vol_FAS2750_SAS7_usage'=2760856465408B;;;0;3518437212160 'SANSVM/vol_FILESERVER1_F_usage'=1644100915200B;;;0;3848290697216 'SANSVM/Vol_FAS2750_SAS1_usage'=2238164684800B;;;0;2748779069440 'SANSVM/Vol_FAS2750_SAS2_usage'=2218098733056B;;;0;2638827909120 'SANSVM/vol_FILESRV2_MCT_usage'=2820834873344B;;;0;5497558138880 'SANSVM/SANSVM_root_usage'=2641920B;;;0;1020055552 'HO1-FAS2750-1/vol0_usage'=46543798272B;;;0;154325098496 'SANSVM/vol_ja_faxcore_d_usage'=738460205056B;;;0;966367641600
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.233 -u jayakrishna.v -p Dubai2020 -o aggregate_health
HO1-FAS2750-1/SASAggr1_HO1_FAS2750_1 - 18.75TB/19.20TB (98%) SPACE USED, HO1-FAS2750-2/aggr0_HO1_FAS2750_2_0 - 152.14GB/159.89GB (95%) SPACE USED, HO1-FAS2750-1/aggr0_HO1_FAS2750_1_0 - 152.14GB/159.89GB (95%) SPACE USED
| 'HO1-FAS2750-2/SATAAggr1_HO1_FAS2750_1_usage'=44908811034624B;;;0;56518443778048 'HO1-FAS2750-1/SASAggr1_HO1_FAS2750_1_usage'=20615394873344B;;;0;21107937116160 'HO1-FAS2750-2/aggr0_HO1_FAS2750_2_0_usage'=163356520448B;;;0;171675226112 'HO1-FAS2750-1/aggr0_HO1_FAS2750_1_0_usage'=163356528640B;;;0;171675226112
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.233 -u jayakrishna.v -p Dubai2020 -o port_health
HO1-FAS2750-2/e0d is down but admin status is up, HO1-FAS2750-1/e0d is down but admin status is up
[root@HO1-NAGIOSXI libexec]#
Please suggest.
The plugin is working fine for some of the NetApp devices (NetApp 7-mode & Santricity array’s ) but it is giving error for others. I checked the devices are reachable from Nagios. PFB details for your information:
[root@HO1-NAGIOSXI libexec]# ping 10.1.0.221
PING 10.1.0.221 (10.1.0.221) 56(84) bytes of data.
64 bytes from 10.1.0.221: icmp_seq=1 ttl=64 time=0.208 ms
64 bytes from 10.1.0.221: icmp_seq=2 ttl=64 time=0.200 ms
64 bytes from 10.1.0.221: icmp_seq=3 ttl=64 time=0.223 ms
64 bytes from 10.1.0.221: icmp_seq=4 ttl=64 time=0.170 ms
64 bytes from 10.1.0.221: icmp_seq=5 ttl=64 time=0.208 ms
^C
--- 10.1.0.221 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 41ms
rtt min/avg/max/mdev = 0.170/0.201/0.223/0.025 ms
[root@HO1-NAGIOSXI libexec]#
But we can see the error as:
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.221 -u jayakrishna.v -p Dubai2020 -o volume_health
Failed test query: in Zapi::invoke, cannot connect to socket
[root@HO1-NAGIOSXI libexec]#
Other IP is:
[root@HO1-NAGIOSXI libexec]# ping 10.1.0.29
PING 10.1.0.29 (10.1.0.29) 56(84) bytes of data.
64 bytes from 10.1.0.29: icmp_seq=1 ttl=128 time=0.217 ms
64 bytes from 10.1.0.29: icmp_seq=2 ttl=128 time=0.126 ms
64 bytes from 10.1.0.29: icmp_seq=3 ttl=128 time=0.164 ms
64 bytes from 10.1.0.29: icmp_seq=4 ttl=128 time=0.196 ms
^C
--- 10.1.0.29 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 33ms
rtt min/avg/max/mdev = 0.126/0.175/0.217/0.038 ms
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.29 -u jayakrishna.v -p Dubai2020 -o volume_health
Failed test query: in Zapi::invoke, cannot connect to socket
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 172.16.10.5 -u jayakrishna.v -p Dubai2020 -o filer_hardware_health
Failed test query: Server returned HTTP Error:
[root@HO1-NAGIOSXI libexec]#
Below is the one where we can see it is working perfectly fine.
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.233 -u jayakrishna.v -p Dubai2020 -o volume_health
SANSVM/Vol_FAS2750_SATA2 - 2.02TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SATA6 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SATA8 - 2.01TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SATA3 - 2.34TB/2.70TB (87%) SPACE USED, SANSVM/Vol_FAS2750_SATA7 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SATA9 - 2.02TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SAS3 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SATA1 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SAS4 - 2.33TB/2.70TB (86%) SPACE USED, SANSVM/Vol_FAS2750_SATA5 - 2.03TB/2.40TB (85%) SPACE USED, SANSVM/Vol_FAS2750_SAS6 - 2.02TB/2.50TB (81%) SPACE USED, SANSVM/Vol_FAS2750_SAS2 - 2.02TB/2.40TB (84%) SPACE USED, SANSVM/Vol_FAS2750_SAS1 - 2.04TB/2.50TB (81%) SPACE USED, SANSVM/Vol_FAS2750_SAS5 - 2.34TB/2.70TB (87%) SPACE USED
| 'SANSVM/Vol_FAS2750_SATA9_usage'=2219111960576B;;;0;2638827909120 'SANSVM/Lun_HO1_COMMVAULT1_usage'=1066706034688B;;;0;2199023255552 'SANSVM/Vol_FAS2750_SATA1_usage'=2230700564480B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA3_usage'=2569660665856B;;;0;2968681398272 'SANSVM/Vol_FAS2750_SAS5_usage'=2574528737280B;;;0;2968681398272 'SANSVM/Vol_FAS2750_SAS3_usage'=2235830239232B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA2_usage'=2217813024768B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA6_usage'=2232081240064B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SATA5_usage'=2231548436480B;;;0;2638827909120 'SANSVM/Lun_HO1_COMMVAULT_usage'=10281132032B;;;0;214748364800 'SANSVM/vol_FILESRV2_3D_usage'=2277659054080B;;;0;4398046511104 'SANSVM/Vol_FAS2750_SATA4_usage'=2685575364608B;;;0;109951162830848 'SANSVM/Vol_FAS2750_SATA8_usage'=2213347049472B;;;0;2638827909120 'SANSVM/vol_FILESRV2_REAL_usage'=592866197504B;;;0;1099511627776 'HO1-FAS2750-2/vol0_usage'=49291603968B;;;0;154325098496 'SANSVM/Vol_FAS2750_SAS6_usage'=2219019354112B;;;0;2748779069440 'SANSVM/Vol_FAS2750_SATA7_usage'=2233722609664B;;;0;2638827909120 'SANSVM/Vol_FAS2750_SAS4_usage'=2557812695040B;;;0;2968681398272 'SANSVM/vol_FILESERVER1_MCTBDD_usage'=914895663104B;;;0;1649267441664 'SANSVM/Lun_FAS2750_Test_usage'=92696576B;;;0;53687091200 'SANSVM/vol_FILESRV2_HR_usage'=147512463360B;;;0;429496729600 'SANSVM/Vol_FAS2750_SAS7_usage'=2760856465408B;;;0;3518437212160 'SANSVM/vol_FILESERVER1_F_usage'=1644100915200B;;;0;3848290697216 'SANSVM/Vol_FAS2750_SAS1_usage'=2238164684800B;;;0;2748779069440 'SANSVM/Vol_FAS2750_SAS2_usage'=2218098733056B;;;0;2638827909120 'SANSVM/vol_FILESRV2_MCT_usage'=2820834873344B;;;0;5497558138880 'SANSVM/SANSVM_root_usage'=2641920B;;;0;1020055552 'HO1-FAS2750-1/vol0_usage'=46543798272B;;;0;154325098496 'SANSVM/vol_ja_faxcore_d_usage'=738460205056B;;;0;966367641600
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.233 -u jayakrishna.v -p Dubai2020 -o aggregate_health
HO1-FAS2750-1/SASAggr1_HO1_FAS2750_1 - 18.75TB/19.20TB (98%) SPACE USED, HO1-FAS2750-2/aggr0_HO1_FAS2750_2_0 - 152.14GB/159.89GB (95%) SPACE USED, HO1-FAS2750-1/aggr0_HO1_FAS2750_1_0 - 152.14GB/159.89GB (95%) SPACE USED
| 'HO1-FAS2750-2/SATAAggr1_HO1_FAS2750_1_usage'=44908811034624B;;;0;56518443778048 'HO1-FAS2750-1/SASAggr1_HO1_FAS2750_1_usage'=20615394873344B;;;0;21107937116160 'HO1-FAS2750-2/aggr0_HO1_FAS2750_2_0_usage'=163356520448B;;;0;171675226112 'HO1-FAS2750-1/aggr0_HO1_FAS2750_1_0_usage'=163356528640B;;;0;171675226112
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]#
[root@HO1-NAGIOSXI libexec]# ./check_netapp_ontap.pl -H 10.1.0.233 -u jayakrishna.v -p Dubai2020 -o port_health
HO1-FAS2750-2/e0d is down but admin status is up, HO1-FAS2750-1/e0d is down but admin status is up
[root@HO1-NAGIOSXI libexec]#
Please suggest.