Tozz
9 January 2024 09:48
1
I’ve made a change to the discovery and poller code to add support to retrieve FortiGate license expiration days. It would show up in the GUI as following:
The OID returns a date string, eg ‘Mon 11 November 2030’, I translate this into days left. So this number would decrease every day until the license is renewed. For this I used a couple of lines of code in includes/plling/sensors/count/fortigate.inc.php
Is this something that LibreNMS would accept as a PR?
4 Likes
Yes, LibreNMS would accept this PR.
trs80
12 January 2024 04:28
3
This is working for some of my Fortigates, but only the virtual ones. I can’t work out why it’s not triggering on discovery for the physical ones I have.
Tozz
12 January 2024 07:42
4
I tested this on physical appliances only, version 7.0.x and 7.2.x. Works on all of them.
What version are you running?
trs80
15 January 2024 01:55
5
500E running 7.2.6 and 60F running 7.0.12
Tozz
15 January 2024 11:47
6
I don’t have a 500E so I can’t check it out, but I checked various other E-gen FortiGate’s. As long as they are running v7.x they seem to support lease expiration information from SNMP. Also checked a 1200D running 7.0.13, also works.
I only found v6.x devices not to work.
Could you run a SNMP walk?
snmpwalk <credentials> <ip> -M /opt/librenms/mibs:/opt/librenms/mibs/fortinet -m FORTINET-FORTIGATE-MIB fgLicContractExpiry
trs80
16 January 2024 07:33
7
The OIDs are there:
FORTINET-FORTIGATE-MIB::fgLicContractExpiry.1 = STRING: Thu Dec 7 08:00:00 2023
FORTINET-FORTIGATE-MIB::fgLicContractExpiry.2 = STRING: Thu Dec 7 08:00:00 2023
FORTINET-FORTIGATE-MIB::fgLicContractExpiry.3 = STRING: Thu Dec 7 08:00:00 2023
I tried a manual discovery but don’t see any attempt to query them
trs80
16 January 2024 07:50
8
The odd thing is I don’t see fgSysSesRate# sensors either in the discovery, but they do exist for the device. But I think the issue is includes/discovery/sensors/count/fortigate.inc.php
isn’t being called for the physical devices for some reason.
SNMPv2-MIB::sysObjectID.0 = OID: FORTINET-FORTIGATE-MIB::fgt500E
SNMPv2-MIB::sysObjectID.0 = OID: FORTINET-FORTIGATE-MIB::fgt61E
Tozz
16 January 2024 21:27
9
Could you give me SNMP access to one of those?
trs80
1 February 2024 06:29
10
Issue opened, it’s something to do with device discovery
opened 07:51AM - 22 Jan 24 UTC
### The problem
Discovery of some (but not all - the VM ones are OK) Fortigate … devices has an error:
[0;31mError discovering sensors module for mizar.ccgs.wa.edu.au.[0m TypeError: long2ip(): Argument #1 ($ip) must be of type int, float given in /opt/librenms/LibreNMS/Util/IP.php:65
Stack trace:
#0 /opt/librenms/LibreNMS/Util/IP.php(65): long2ip()
#1 /opt/librenms/LibreNMS/Device/YamlDiscovery.php(210): LibreNMS\Util\IP::fromHexString()
#2 [internal function]: LibreNMS\Device\YamlDiscovery::LibreNMS\Device\{closure}()
#3 /opt/librenms/app/View/SimpleTemplate.php(111): preg_replace_callback()
#4 /opt/librenms/LibreNMS/Device/YamlDiscovery.php(220): App\View\SimpleTemplate->__toString()
#5 /opt/librenms/includes/discovery/functions.inc.php(933): LibreNMS\Device\YamlDiscovery::replaceValues()
#6 /opt/librenms/includes/discovery/functions.inc.php(1026): discovery_process()
#7 /opt/librenms/includes/discovery/sensors.inc.php(87): sensors()
#8 /opt/librenms/includes/discovery/functions.inc.php(164): include('...')
#9 /opt/librenms/discovery.php(108): discover_device()
#10 {main}
### Output of ./validate.php
```txt
===========================================
Component | Version
--------- | -------
LibreNMS | 24.1.0-42-g0b8413ed9 (2024-01-19T23:14:29+08:00)
DB Schema | 2023_12_12_171400_alert_rule_note (277)
PHP | 8.1.23
Python | 3.7.3
Database | MariaDB 10.3.39-MariaDB-0+deb10u1-log
RRDTool | 1.7.1
SNMP | 5.7.3
===========================================
[OK] Composer Version: 2.6.6
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database Schema is current
[OK] SQL Server meets minimum requirements
[OK] lower_case_table_names is enabled
[OK] MySQL engine is optimal
[OK] Database and column collations are correct
[OK] Database schema correct
[OK] MySQL and PHP time match
[OK] Active pollers found
[OK] Dispatcher Service not detected
[OK] Locks are functional
[OK] Python poller wrapper is polling
[OK] Redis is unavailable
[OK] rrdtool version ok
[OK] Connected to rrdcached
[WARN] Global lnms shortcut not installed. lnms command must be run with full path
[FIX]:
sudo ln -s /opt/librenms/lnms /usr/local/bin/lnms
[WARN] Your local git contains modified files, this could prevent automatic updates.
[FIX]:
You can fix this with ./scripts/github-remove
Modified Files:
LibreNMS/OS/Ewc.php
composer.json
composer.lock
includes/discovery/sensors/voltage/netagent2.inc.php
includes/polling/cisco-voice/cisco-iosdsp.inc.php
includes/polling/cisco-voice/cisco-iospri.inc.php
mibs/fortinet/FORTINET-FORTIMANAGER-FORTIANALYZER-MIB
[FAIL] We have found some files that are owned by a different user than 'librenms', this will stop you updating automatically and / or rrd files being updated causing graphs to fail.
[FIX]:
sudo chown -R librenms:librenms /opt/librenms
sudo setfacl -d -m g::rwx /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
sudo chmod -R ug=rwX /opt/librenms/rrd /opt/librenms/logs /opt/librenms/bootstrap/cache/ /opt/librenms/storage/
Files:
/opt/librenms/storage/app/purifier/HTML/4.17.0,fe97c36109f79a043b63c51aaa36362f0f2f6553,1.ser
```
### What was the last working version of LibreNMS?
_No response_
### Device info
Fortigate
### Discovery output
```txt
./discovery.php -h 323 -d -m sensors | ./pbin.sh
https://p.libren.ms/view/445c645c
```
### Poller output
```txt
./lnms device:poll mizar.ccgs.wa.edu.au -vv --no-data | ./pbin.sh
https://p.libren.ms/view/a3a971db
```
Oddly I have a 600F cluster that is reporting expiry correctly.
system
Closed
1 May 2024 06:30
11
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.