Send netdisco-users mailing list submissions to
netdisco-users@lists.sourceforge.net
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.sourceforge.net/lists/listinfo/netdisco-users
or, via email, send a message with subject or body 'help' to
netdisco-users-requ...@lists.sourceforge.net
You can reach the person managing the list at
netdisco-users-ow...@lists.sourceforge.net
When replying, please edit your Subject line so it is more specific
than "Re: Contents of netdisco-users digest..."
Today's Topics:
1. Re: Cisco IMEI tracker report for cellular services
(Oliver Gorwits)
--- Begin Message ---
Hi Muris
I suspect strongly this is a version issue with one of the database
libraries used in Netdisco. Perhaps related to the specific
version provided by the operating system.
The error is because the query uses "?" which is a PostgreSQL jsonb
operator. SQL libraries also use "?" for bind parameters. It should be
possible to escape them like "\?" as in the documented query, and on my
system that works, but on yours it doesn't. The escape should make it be
interpreted as an operator, not a bind parameter.
I have no idea how to fix this, sorry. I guess it could be worked around by
refactoring the query not to use the PostgreSQL jsonb operator "?".
regards
Oliver.
On Tue, 17 Sept 2024 at 15:35, Muris <alcat...@gmail.com> wrote:
> Hi Oliver, just wanted to let you know I spent hours to get it to work on
> the production Red Hat box but didn’t have much luck the same error keeps
> popping up.
>
>
>
> But the fields are populating because I can see it on individual device
> when I click on it it says IMEI/GSM values. Also I see in the backend db
> custom_fields options are being populated.
>
>
>
> So Redhat 7.6 is running
>
>
>
> Netdisco 2.79.1
>
> SNMP Info 3.972.0
>
> DB Schema 88
>
> PostgreSQL 12.00.6
>
> Perl 5.16.3
>
> Python 3.9.19
>
>
>
> Muris
>
>
>
> *From: *Muris <alcat...@gmail.com>
> *Date: *Tuesday 17 September 2024 at 18:48
> *To: *Oliver Gorwits <oli...@cpan.org>
> *Cc: *<netdisco-users@lists.sourceforge.net>
> *Subject: *Re: [Netdisco] Cisco IMEI tracker report for cellular services
>
>
>
> Thanks, im thinking of leaving it open wide because we never really know
> what can be deployed out there.
>
>
>
> I got this to work on my almalinux 8 test box.. but in production under
> red hat 7.6 I cant get it working.. this is the error I get on the backend.
>
>
>
> Any ideas?
>
>
>
> 9307] 2024-09-17 09:13:34 error request to GET
> /ajax/content/report/cisco_cellular_routers crashed:
> DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::Pg::st
> execute failed: execute called with an unbound placeholder [for Statement
> "SELECT me.devname, me.ip, me.carrier, me.imei FROM (SELECT
> COALESCE(NULLIF(dns,''), NULLIF(name,''), '') AS devname, ip,
>
> ARRAY(SELECT json_array_elements_text((custom_fields ->>
> 'c3gGsmNetwork')::json))::text[] AS carrier,
>
> ARRAY(SELECT json_array_elements_text((custom_fields ->>
> 'c3gImei')::json))::text[] AS imei
>
> FROM device
>
> WHERE
>
> (custom_fields \? 'c3gGsmNetwork' AND json_array_length((custom_fields
> ->> 'c3gGsmNetwork')::json) > 0)
>
> OR
>
> (custom_fields \? 'c3gImei' AND json_array_length((custom_fields ->>
> 'c3gImei')::json) > 0)
>
> ORDER BY ip ASC
>
> ) me" with ParamValues: 1=undef, 2=undef] at
> /home/netdisco/perl5/lib/perl5/App/Netdisco/Web/GenericReport.pm line 66
>
>
>
>
>
>
>
> *From: *Oliver Gorwits <oli...@cpan.org>
> *Date: *Tuesday 17 September 2024 at 16:40
> *To: *Muris <alcat...@gmail.com>
> *Cc: *<netdisco-users@lists.sourceforge.net>
> *Subject: *Re: [Netdisco] Cisco IMEI tracker report for cellular services
>
>
>
> Hi Muris,
>
>
>
> Many thanks! I'm so pleased it works well. And thank you for the WHERE
> clause tweak, what a good idea. I've put that into the wiki example.
>
>
>
> For efficiency there is an undocumented feature you can use to only gather
> this info for the cellular routers. Add the traditional "only/no" ACL to
> the custom_fields specification, like so:
>
>
>
> host_groups:
> cellular_routers:
>
> - 10.1.1.1
>
> custom_fields:
> device:
> - name: 'imei'
> label: 'IMEI'
> snmp_object: 'CISCO-WAN-3G-MIB::c3gImei'
>
> only: 'group:cellular_routers'
>
>
>
> (It's undocumented because it would cause some confusion without me
> implementing another feature alongside, but is intentionally coded to solve
> your problem, don't worry.)
>
>
>
> To your second question - it will be fine. The report is a query against
> the database which has the data from the last time the device was
> discovered, so the old IMEI/Carrier will be there in the record.
>
>
>
> (Eventually, of course, Netdisco will give up on trying to discover
> devices which are offline, and you may need to manually trigger the
> discover to wake it up; and after a longer time, the devices are cleaned up
> I think. But I guess you're aware of these issues and use the relevant
> config to change the behaviour if needed.)
>
>
>
> Hope this helps,
>
>
>
> regards
>
> oliver
>
>
>
>
>
> On Tue, 17 Sept 2024 at 03:35, Muris <alcat...@gmail.com> wrote:
>
> Hi Oliver, well I must say you are the master of netdisco.. that works
> brilliant, but it also lists other devices which don’t have a IMEI/SIM
> attached
>
>
>
> Ive made a modification to your WHERE clause so it only populates the
> report if it finds IMEI or Carrier, but all the other blanks are not
> listed, so the report is not going to be thousands of devices with lot of
> blanks.
>
>
>
> WHERE
>
> (custom_fields \? 'c3gGsmNetwork' AND json_array_length((custom_fields
> ->> 'c3gGsmNetwork')::json) > 0)
>
> OR
>
> (custom_fields \? 'c3gImei' AND json_array_length((custom_fields ->>
> 'c3gImei')::json) > 0)
>
> ORDER BY ip ASC
>
>
>
> Also will it slow down discoveries if it has to check each device for imei
> and carrier?
>
>
>
> What if the device goes offline for a period, is the report still going to
> be stored in the database incase router isn’t reachable?
>
>
>
> Muris
>
>
>
> *From: *Oliver Gorwits <oli...@cpan.org>
> *Date: *Tuesday 17 September 2024 at 06:49
> *To: *Muris <alcat...@gmail.com>
> *Cc: *<netdisco-users@lists.sourceforge.net>
> *Subject: *Re: [Netdisco] Cisco IMEI tracker report for cellular services
>
>
>
> Hi Muris
>
>
>
> Just following up on your feature requests. As you have recently upgraded,
> this is _mostly_ possible, with the exception of historic data.
>
>
>
> 1. Install the "jq" tool on your system. This should be available in an OS
> package, or else is very portable and here:
> https://jqlang.github.io/jq/download/
>
>
>
> 2. Use the example here in the docs:
> https://github.com/netdisco/netdisco/wiki/Custom-Report-Examples#custom-fields-in-a-query
>
>
>
> This sets up two custom fields on your devices for IMEI and Carrier,
> activates automagic SNMP retrieval, and then sets up a custom report to
> view them.
>
>
>
> Run a discover job and wait a bit.
>
>
>
> 3. Profit! ;-)
>
>
>
> This automagically handles devices with multiple modems, btw. You're
> welcome!
>
>
>
> regards
>
> oliver.
>
>
>
> On Thu, 12 Sept 2024 at 07:36, Muris <alcat...@gmail.com> wrote:
>
> Hi Oliver , that works, can you also add the carrier type ? It is
> c3gGsmNetwork
>
>
>
> It would be nice to have a report something like Reports > Device > Cisco
> Cellular Routers IMEI
>
>
>
> Then it gives name of the router/ip address/carrier/imei/number.
>
> Maybe also something to track IMEI number & GSM network changes for a
> specific device and when it was last seen/and or updated, with some
> historical data
>
>
>
> ~/bin/netdisco-do show -d 10.1.1.1 -e CISCO-WAN-3G-MIB::c3gImei -D
>
> [22153] 2024-09-12 04:38:29 info App::Netdisco version 2.074001 loaded.
>
> [22153] 2024-09-12 04:38:29 info show:
> [10.1.1.1]/CISCO-WAN-3G-MIB::c3gImei started at Thu Sep 12 14:08:29 2024
>
> [22153] 2024-09-12 04:38:30 debug show: running with timeout 600s
>
> [22153] 2024-09-12 04:38:30 debug => running workers for phase: check
>
> [22153] 2024-09-12 04:38:30 debug -> run worker check/1000000
> "internal::backendfqdn"
>
> [22153] 2024-09-12 04:38:30 debug -> run worker check/1000000
> "internal::snmpfastdiscover"
>
> [22153] 2024-09-12 04:38:30 debug running with configured SNMP timeouts
>
> [22153] 2024-09-12 04:38:30 debug -> run worker check/0 "show"
>
> [22153] 2024-09-12 04:38:30 debug Show is able to run
>
> [22153] 2024-09-12 04:38:30 debug => running workers for phase: main
>
> [22153] 2024-09-12 04:38:30 debug -> run worker main/100 "show"
>
> [22153] 2024-09-12 04:38:30 debug snmp reader cache warm: [10.1.1.1]
>
> [22153] 2024-09-12 04:38:30 debug [10.1.1.1:161] try_connect with v: 2,
> t: 0.2, r: 0, class: SNMP::Info::Layer3::CiscoSwitch, comm: <hidden>
>
> {
>
> 21 99424056879145
>
> }
>
> [22153] 2024-09-12 04:38:32 info show: finished at Thu Sep 12 14:08:32
> 2024
>
> [22153] 2024-09-12 04:38:32 info show: status done: Showed
> CISCO-WAN-3G-MIB::c3gImei response from 10.1.1.1
>
>
>
>
>
> ~/bin/netdisco-do show -d 10.1.1.1 -e CISCO-WAN-3G-MIB::c3gGsmNetwork -D
>
> [23874] 2024-09-12 04:41:30 info App::Netdisco version 2.074001 loaded.
>
> [23874] 2024-09-12 04:41:30 info show:
> [10.1.1.1]/CISCO-WAN-3G-MIB::c3gGsmNetwork started at Thu Sep 12 14:11:30
> 2024
>
> [23874] 2024-09-12 04:41:30 debug show: running with timeout 600s
>
> [23874] 2024-09-12 04:41:30 debug => running workers for phase: check
>
> [23874] 2024-09-12 04:41:30 debug -> run worker check/1000000
> "internal::backendfqdn"
>
> [23874] 2024-09-12 04:41:30 debug -> run worker check/1000000
> "internal::snmpfastdiscover"
>
> [23874] 2024-09-12 04:41:30 debug running with configured SNMP timeouts
>
> [23874] 2024-09-12 04:41:30 debug -> run worker check/0 "show"
>
> [23874] 2024-09-12 04:41:30 debug Show is able to run
>
> [23874] 2024-09-12 04:41:30 debug => running workers for phase: main
>
> [23874] 2024-09-12 04:41:30 debug -> run worker main/100 "show"
>
> [23874] 2024-09-12 04:41:30 debug snmp reader cache warm: [10.1.1.1]
>
> [23874] 2024-09-12 04:41:30 debug [10.1.1.1:161] try_connect with v: 2,
> t: 0.2, r: 0, class: SNMP::Info::Layer3::CiscoSwitch, comm: <hidden>
>
> {
>
> 21 "Telstra"
>
> }
>
> [23874] 2024-09-12 04:41:32 info show: finished at Thu Sep 12 14:11:32
> 2024
>
> [23874] 2024-09-12 04:41:32 info show: status done: Showed
> CISCO-WAN-3G-MIB::c3gGsmNetwork response from 10.1.1.1
>
>
>
> *From: *Oliver Gorwits <oli...@cpan.org>
> *Date: *Wednesday 11 September 2024 at 23:58
> *To: *Muris <alcat...@gmail.com>
> *Cc: *"netdisco-users@lists.sourceforge.net" <
> netdisco-users@lists.sourceforge.net>
> *Subject: *Re: [Netdisco] Cisco IMEI tracker report for cellular services
>
>
>
> Hi Muris!
>
>
>
> I think this may be possible but can you send the output of this command,
> please (to me direct by email is fine, if you don't wish to share widely):
>
>
>
> ~/bin/netdisco-do show -d x.x.x.x -e CISCO-WAN-3G-MIB::c3gImei -D
>
>
>
> regards,
>
> oliver.
>
>
>
> On Wed, 11 Sept 2024 at 07:35, Muris <alcat...@gmail.com> wrote:
>
> Hi,
>
>
>
> I was wondering is it possible to add an extra field in netdisco to
> collect Cisco IMEI numbers for tracking cellular services?
>
>
>
> The SNMP Oid for Cisco IMEI is .1.3.6.1.4.1.9.9.661.1.3.1.1.2
>
>
>
> This way a report can be made with hostname of the router and attached IMEI
>
>
>
> I just thought this would be useful for tracking hundreds of routers on
> cellular services and if they have been seen online/or if it matches with
> the carrier etc
>
>
>
> Muris
>
>
>
>
>
>
>
> _______________________________________________
> Netdisco mailing list
> netdisco-users@lists.sourceforge.net
> https://sourceforge.net/p/netdisco/mailman/netdisco-users/
>
> _______________________________________________
> Netdisco mailing list
> netdisco-users@lists.sourceforge.net
> https://sourceforge.net/p/netdisco/mailman/netdisco-users/
>
--- End Message ---
_______________________________________________
Netdisco mailing list - Digest Mode
netdisco-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/netdisco-users