with_times
This is a modifier for any search() (including the helpers below) which will add the following additional synthesized columns to the result set:
- time_first_stamp
- time_last_stamp
with_router
This is a modifier for any search() (including the helpers below) which will add the following additional synthesized column to the result set:
- router_ip
- router_name
search_by_ip( \%cond, \%attrs? )
my $set = $rs->search_by_ip({ip => '192.0.2.1', active => 1});
Like search(), this returns a ResultSet of matching rows from the NodeIp table.
The
condparameter must be a hashref containing a keyipwith the value to search for. Value can either be a simple string of IPv4 or IPv6, or a NetAddr::IP::Lite object in which case all results within the CIDR/Prefix will be retrieved.Results are ordered by time last seen.
Additional columns
time_first_stampandtime_last_stampprovide preformatted timestamps of thetime_firstandtime_lastfields.A JOIN is performed on the Manufacturer table and the Manufacturer
companycolumn prefetched.
To limit results only to active IPs, set {active => 1} in cond.
search_by_dns( \%cond, \%attrs? )
my $set = $rs->search_by_dns({
dns => 'foo.example.com',
suffix => qr/(?:\.example\..com|\.local)$/,
active => 1
});
Like search(), this returns a ResultSet of matching rows from the NodeIp table.
The NodeIp table must have a
dnscolumn for this search to work. Typically this column is the IP's DNS PTR record, cached at the time of Netdisco Arpnip.The
condparameter must be a hashref containing a keydnswith the value to search for. The value may optionally include SQL wildcard characters.If
dnsis a plain string, then thecondparameter may optionally have asuffixparameter which is a regular expression of domain names - one of which must match the results.Results are ordered by time last seen.
Additional columns
time_first_stampandtime_last_stampprovide preformatted timestamps of thetime_firstandtime_lastfields.A JOIN is performed on the Manufacturer table and the Manufacturer
companycolumn prefetched.
To limit results only to active IPs, set {active => 1} in cond.
search_by_mac( \%cond, \%attrs? )
my $set = $rs->search_by_mac({mac => '00:11:22:33:44:55', active => 1});
Like search(), this returns a ResultSet of matching rows from the NodeIp table.
The
condparameter must be a hashref containing a keymacwith the value to search for.Results are ordered by time last seen.
Additional columns
time_first_stampandtime_last_stampprovide preformatted timestamps of thetime_firstandtime_lastfields.A JOIN is performed on the Manufacturer table and the Manufacturer
companycolumn prefetched.
To limit results only to active IPs, set {active => 1} in cond.
ip_version( $version )
my $rset = $rs->ip_version(4);
This predefined search() returns a ResultSet of matching rows from the NodeIp table of nodes with addresses of the supplied IP version.
The
versionparameter must be an integer either 4 or 6.