Compare commits

...

189 Commits

Author SHA1 Message Date
Daniel Berteaud a99caf808d Update README 2023-12-08 13:34:00 +01:00
Daniel Berteaud 2e5c4f8bd2 Merge remote-tracking branch 'upstream/master' 2023-12-08 11:30:27 +01:00
Riccardo 8c37f43c98
Merge pull request #152 from AphidGit/sysversion_cron
Changes how the system version is tracked from direct to via a cronjob.
2023-10-22 19:02:05 +02:00
AphidGit 791bf5a09b Changes how the system version is tracked from direct to via a cronjob.
Add instruction for how to enable this to .md file.
Add both cronjobs to disable function.
Add a timeout to stop a stuck function from causing problems.
2023-10-16 12:14:35 +02:00
Riccardo c2a836f020
Merge pull request #146 from guggemand/master
New openvpn status on p2p_shared_key servers
2023-07-18 11:14:28 +02:00
Riccardo 01df64a506
Merge pull request #147 from guggemand/openvpn-client
New openvpn client status
2023-07-18 09:25:56 +02:00
Karsten Schmidt a00cab7652 New openvpn client status 2023-07-09 14:48:36 +02:00
Karsten Schmidt efeaf8a47a New openvpn status on p2p_shared_key servers 2023-07-02 10:27:18 +02:00
Riccardo 6eb9e5d948
Merge pull request #142 from edeckers/elydeckers/feature/fix-service-status
Fix stale "Service SSH Daemon is running" trigger
2023-05-17 17:47:40 +02:00
Riccardo f419ca46e0
Merge pull request #139 from edeckers/elydeckers/fix/broken-variable-initializations-php-8-1
Fix broken variable initializations php 8.1
2023-05-17 17:47:03 +02:00
Ely Deckers f8c81f11de fix: disabled service status 2023-04-01 12:49:49 +02:00
Ely Deckers b07d9074e9 Fix Speedtest variable initialization 2023-03-14 16:54:26 +01:00
Ely Deckers f8c0630c80 fix: broken variable initializations php 8.1 2023-03-12 22:34:12 +01:00
Riccardo 134cbe0cd9
Merge pull request #134 from edeckers/elydeckers/fix/broken-pfsense-23-php-8-1
Fix pfSense 23.01 / PHP8 fatal error
2023-03-03 17:54:43 +01:00
Ely Deckers 13b3156c27 Fix pfSense 23.01 / PHP8 fatal error 2023-03-03 11:42:29 +01:00
Riccardo Bicelli fbd6a363af Updated template files 2023-02-26 17:20:16 +01:00
Riccardo Bicelli 40422f9dd6 Fixed Issues: resolve #120, resolve #127 2023-02-26 17:07:26 +01:00
Riccardo 85717b73d5
Merge pull request #131 from synedraIT/master
added revocation check to certificate monitoring
2023-02-26 16:25:28 +01:00
Riccardo Bicelli a19082212f Renamed files 2023-02-26 16:21:07 +01:00
Riccardo Bicelli b163afc979 Reverted to original php script 2023-02-26 16:11:38 +01:00
Riccardo Bicelli ad4a903899 Fixed Readme 2023-02-26 14:29:43 +01:00
Riccardo Bicelli 810cf8c7e5 Added templates in yaml format for Zabbix 6 2023-02-26 14:27:51 +01:00
Riccardo Bicelli d8f5a1532e Added legacy script 2023-02-26 13:21:25 +01:00
Riccardo Bicelli 88d53e28dd Merge branch 'edeckers-elydeckers/feature/simplify-php-script'
Added new PHP script from Ely Deckers
2023-02-26 13:17:57 +01:00
Riccardo Bicelli 29c41a01da Merge branch 'elydeckers/feature/simplify-php-script' of https://github.com/edeckers/pfsense-zabbix-template into edeckers-elydeckers/feature/simplify-php-script
Switch to new PHP Script
2023-02-26 13:17:08 +01:00
Riccardo Bicelli 8937d88d7c Start working on pfSense Plus releases 2023-02-26 13:11:06 +01:00
Riccardo Bicelli 74fe64349c merge 2023-02-26 12:16:21 +01:00
tst 58069dc19c added revocation check to certificate monitoring 2023-01-03 11:54:04 +01:00
Ely Deckers 88c7cb2abf refactor: move ipsec_conid to PvEnv class 2022-11-29 23:20:49 +01:00
Ely Deckers 5265b64ca3 fix: ipsec status dectection 2022-11-29 23:20:49 +01:00
Ely Deckers be58c15c5c Replace ternary with explicit if statements 2022-11-29 23:20:49 +01:00
Ely Deckers 40c5ca87cd Replace array_map with foreach 2022-11-29 23:20:49 +01:00
Ely Deckers e603ca1a7b fix: use 'state' for vpn 'status' check on 22.05+ 2022-11-29 23:20:49 +01:00
Ely Deckers 66f4615423 Fix cert_date when no cert or ca available 2022-11-29 23:20:49 +01:00
Ely Deckers 56ee15d483 Reinstate exclusive running of speedtests 2022-11-29 23:20:49 +01:00
Ely Deckers 3996432202 Fix gateway discovery 2022-11-29 23:20:48 +01:00
Ely Deckers 32a42bcad4 Fallback to empty array when null 2022-11-29 23:20:48 +01:00
Ely Deckers dd578c70c8 Change variable to const 2022-11-29 23:20:48 +01:00
Ely Deckers 286aee913c Fix indenting 2022-11-29 23:20:48 +01:00
Ely Deckers fc6f0b0cd2 Rename and simplify some Shell methods 2022-11-29 23:20:48 +01:00
Ely Deckers 7f22ed2971 Contain all calls to shell scripts in class 2022-11-29 23:20:48 +01:00
Ely Deckers 252876cd29 Swap array_first paramters 2022-11-29 23:20:48 +01:00
Ely Deckers 15e6ad239b Return correct SMART status 2022-11-29 23:20:48 +01:00
Ely Deckers 62882ab8fe Replace magic numbers with constants 2022-11-29 23:20:48 +01:00
Ely Deckers 5e5d1654ae Use FALLBACK_VALUE const where applicable 2022-11-29 23:20:48 +01:00
Ely Deckers b838274280 Remove redundant default_value parameter 2022-11-29 23:20:48 +01:00
Ely Deckers 0d8d75a08b Use 0 as fallback value for ipsec_ph 2022-11-29 23:20:48 +01:00
Ely Deckers 9d46326dbb Get rid of echo_result parameter for carp_status 2022-11-29 23:20:48 +01:00
Ely Deckers 78f7056bb2 Replace all echos with Util::result where applicable 2022-11-29 23:20:48 +01:00
Ely Deckers d76b2d0cb1 Remove redundant preg_match escape characters 2022-11-29 23:20:48 +01:00
Ely Deckers 618c9bc010 Use 0 as fallback for service_value 2022-11-29 23:20:48 +01:00
Ely Deckers 5c060c9185 Make Util::result echo by default 2022-11-29 23:20:48 +01:00
Ely Deckers 5874bf49ad Rename symbols and reorder 2022-11-29 23:20:48 +01:00
Ely Deckers 415ce8d1a4 Fix map building in get_ipsec_status 2022-11-29 23:20:48 +01:00
Ely Deckers 9288a682d0 Fix speed test 2022-11-29 23:20:48 +01:00
Ely Deckers 614c1721de Fix mapping issue in openvpn_client 2022-11-29 23:20:48 +01:00
Ely Deckers ce829110c7 Set fallback value to 0 for openvpn_clientvalue 2022-11-29 23:20:48 +01:00
Ely Deckers 0aee6006e8 Output result for cert_date 2022-11-29 23:20:48 +01:00
Ely Deckers 462389ca9d Fix OpenVPN client value bug 2022-11-29 23:20:48 +01:00
Ely Deckers 0d35fdd92c Change type hint from string to array 2022-11-29 23:20:48 +01:00
Ely Deckers e040a2dc0e Fix services method call 2022-11-29 23:20:48 +01:00
Ely Deckers e47eb9f53a Fix service identification 2022-11-29 23:20:48 +01:00
Ely Deckers 6e7b1bb56b Fix service identifier concatenation 2022-11-29 23:20:48 +01:00
Ely Deckers 31a0b0ad19 Output result for OpenVPN client value 2022-11-29 23:20:48 +01:00
Ely Deckers 835816aab0 Fix Util::result 2022-11-29 23:20:48 +01:00
Ely Deckers 3ff4bb44b7 Fix services_value 2022-11-29 23:20:48 +01:00
Ely Deckers 4afae8cba5 Fix service_value 2022-11-29 23:20:48 +01:00
Ely Deckers 5a4abe940c Add offline leases check 2022-11-29 23:20:48 +01:00
Ely Deckers 1774d6ade9 Fix invalid const reference 2022-11-29 23:20:48 +01:00
Ely Deckers d66c98cb41 Fix style issues 2022-11-29 23:20:48 +01:00
Ely Deckers 6c9eb547d7 Refactor and fix get_dhcp 2022-11-29 23:20:48 +01:00
Ely Deckers c3695d6345 Simplify and fix Command::system 2022-11-29 23:20:48 +01:00
Ely Deckers 283ffb6ffe Sanitize VALUE_MAPPING dictionary 2022-11-29 23:20:48 +01:00
Ely Deckers f2bdbd222c Rename Speedtest class 2022-11-29 23:20:48 +01:00
Ely Deckers 20b631cf9b Inline some variables and simplify code 2022-11-29 23:20:48 +01:00
Ely Deckers b276051950 Inline some variables 2022-11-29 23:20:48 +01:00
Ely Deckers 6844709bcd Fix some style and spelling issues 2022-11-29 23:20:48 +01:00
Ely Deckers 63055d5fa2 Fix some style issues 2022-11-29 23:20:48 +01:00
Ely Deckers 8046c601c4 Simplify duplicate removal method 2022-11-29 23:20:48 +01:00
Ely Deckers b206c2446e Use double quotes consistently 2022-11-29 23:20:48 +01:00
Ely Deckers 3a033695ff Remove superfluous character replacement 2022-11-29 23:20:48 +01:00
Ely Deckers b9f842c9ed Fix undefined variables in get_dhcp 2022-11-29 23:20:48 +01:00
Ely Deckers c8707e5242 Fix array_zip 2022-11-29 23:20:48 +01:00
Ely Deckers 38f73ec622 Fix wan interface retrieval 2022-11-29 23:20:48 +01:00
Ely Deckers 5ccbd7fa59 Fix magic method invocation 2022-11-29 23:20:48 +01:00
Ely Deckers 25b95784ca Add method for flattening array 2022-11-29 23:20:48 +01:00
Ely Deckers 49e708b093 Fix Speedtest issue 2022-11-29 23:20:48 +01:00
Ely Deckers 6a3f5ad040 Simplify SMART status retrieval 2022-11-29 23:20:48 +01:00
Ely Deckers 723cb10263 Fix Speedtest methods 2022-11-29 23:20:48 +01:00
Ely Deckers f47110d1b5 Simplify switch statement in dhcp 2022-11-29 23:20:48 +01:00
Ely Deckers 3b0cd404a4 Define namespace and require everything at top 2022-11-29 23:20:48 +01:00
Ely Deckers de6d82dafc Simplify Ipsec status retrieval 2022-11-29 23:20:48 +01:00
Ely Deckers 6cad428900 Fix CARP code inconsistency 2022-11-29 23:20:48 +01:00
Ely Deckers ce28765be5 Simplify and clean miscellaneous methods 2022-11-29 23:20:48 +01:00
Ely Deckers 41ee512e3e Simplify some low hanging fruit 2022-11-29 23:20:48 +01:00
Ely Deckers aa60579f6e Simplify and clean a few methods 2022-11-29 23:20:48 +01:00
Ely Deckers 8d2f5302b2 Simplify interface_discovery serialization 2022-11-29 23:20:48 +01:00
Ely Deckers 114d511005 Simplify a few json discovery serializations 2022-11-29 23:20:48 +01:00
Ely Deckers 4d23d9320f Re-order discovery methods 2022-11-29 23:20:48 +01:00
Ely Deckers a20a9d86f2 Simplify json generation for discoveries 2022-11-29 23:20:48 +01:00
Ely Deckers d882d3a47f Fix a few methods 2022-11-29 23:20:48 +01:00
Ely Deckers 5d22a253f3 Fix a few methods 2022-11-29 23:20:48 +01:00
Ely Deckers 384e3429b5 Simplify command discovery 2022-11-29 23:20:48 +01:00
Ely Deckers 866a8171f2 Hide public method and rename 2022-11-29 23:20:48 +01:00
Ely Deckers c25675834e Use correct method names and hide private 2022-11-29 23:20:47 +01:00
Ely Deckers 718fcfdf8b Add help command 2022-11-29 23:18:11 +01:00
Ely Deckers 1965594c66 Wrap pfSense symbols in class 2022-11-29 23:18:11 +01:00
Ely Deckers 17be728231 Introduce Command and Discovery classes 2022-11-29 23:18:09 +01:00
Ely Deckers 37d4f1ac0a Simplify Ipsec status 2022-11-29 23:17:19 +01:00
Ely Deckers bbca2fb11f Simplify service values 2022-11-29 23:17:19 +01:00
Ely Deckers 792990b7f6 Simplify ipsec ph1 2022-11-29 23:17:19 +01:00
Ely Deckers 10a51a990d Simplify OpenVPN client value 2022-11-29 23:17:19 +01:00
Ely Deckers 958e4ca9e2 Simplify OpenVPN server values 2022-11-29 23:17:19 +01:00
Ely Deckers 798ffa8b8b Simplify dhcp 2022-11-29 23:17:19 +01:00
Ely Deckers 1229bf6370 Simplify package update status retrieval 2022-11-29 23:17:19 +01:00
Ely Deckers cb11d68518 Simplify system value retrieval 2022-11-29 23:17:19 +01:00
Ely Deckers 956323ec0e Simplify SMART status retrieval 2022-11-29 23:17:19 +01:00
Ely Deckers 63b169b483 Simplify code for value mapping 2022-11-29 23:17:19 +01:00
Ely Deckers 5e4a515b3a Simplify discovery 2022-11-29 23:17:19 +01:00
Ely Deckers c03733370a Move command handlers to top of file 2022-11-29 23:17:19 +01:00
Ely Deckers 9e42d7fea6 Simplify code for entrypoint 2022-11-29 23:17:19 +01:00
Riccardo 7bd0396c55
Merge pull request #130 from edeckers/elydeckers/fix/invalid-ipsec-status-for-some-versions
fix: ipsec tunnel status invalid on some versions
2022-11-29 22:15:02 +01:00
Ely Deckers f81f6778bf fix: ipsec tunnel status invalid on some versions 2022-11-27 14:07:00 +01:00
Riccardo c867bf03cf
Merge pull request #108 from GuillaumeHullin/master
Typo - Issue #104
2022-11-07 23:07:46 +01:00
Riccardo f4f092abf4
Merge pull request #118 from ForesightCyber/master
Repaired get_ipsecifnum. Working with pre 2.6 and 2.6 pfsense
2022-11-07 23:04:11 +01:00
Riccardo Bicelli 5c4a2d1151 Update README 2022-10-10 14:13:25 +02:00
Guillaume Hullin eee0d82102 Removed branding and some not needed changes 2022-09-14 11:43:19 +02:00
Guillaume Hullin 61a88dff0b Revert back code to orignal template
This reverts commit 7134f2f5c365705074e29046748614f028cb6616.
2022-09-14 10:55:13 +02:00
Guillaume Hullin b1210d586a Update README.md 2022-09-14 10:36:23 +02:00
Lukas Macura 038eb5c162 Changed item fetch times. It was too frequent for small firewalls 2022-04-22 12:24:40 +02:00
Lukas Macura 60bbd28bfb Added temperature monitoring 2022-04-22 12:14:34 +02:00
Lukas Macura dcd5121571 Repaired get_ipsecifnum. Working with pre 2.6 and 2.6 pfsense 2022-04-21 11:39:35 +02:00
Guillaume Hullin ca8d7d316f
Merge branch 'main' into master 2022-04-05 22:52:07 +02:00
Guillaume Hullin 2609084db6
Merge branch 'rbicelli:master' into master 2022-04-05 22:36:22 +02:00
Guillaume Hullin ac8a2b2dda Fixing trigger for new pfSense version 2022-03-16 10:49:57 +01:00
Riccardo 67a521fa7b
Merge pull request #107 from edeckers/elydeckers/fix/add-missing-application-to-template
Add "Network Interfaces" application
2022-03-04 16:20:24 +01:00
Guillaume Hullin a58e746bd3 Update README.md 2022-02-16 12:07:39 +01:00
Guillaume Hullin 842e09158d
Merge branch 'rbicelli:master' into master 2022-02-16 10:54:34 +01:00
Guillaume Hullin f14039f039 Update README.md
- typo correction (Issue #104)
2022-02-16 10:53:52 +01:00
Ely Deckers f88338c11d Add 'Network Interfaces' application 2022-02-16 10:44:11 +01:00
Riccardo d4ce65c0a7
Merge pull request #105 from GuillaumeHullin/master
Update README.md
2022-02-16 10:36:07 +01:00
Guillaume Hullin 5ea5a6b831 Update README.md
- Added Certificats Monitoring as feature
- Updated command to install speedtest
- Added advice to Shellcmd in order to make the script automatically install/update at boot time (and after upgrade of pfSense)
2022-02-15 23:38:20 +01:00
Riccardo 9ec91fd337
Merge pull request #102 from GuillaumeHullin/feature_cert_and_services_monitoring
Certificates and services monitoring
2022-01-24 10:25:47 +01:00
Guillaume Hullin 0b8df83056 switch certificate monitoring items to active items 2022-01-21 13:11:18 +01:00
Guillaume Hullin add56b4cd2 Update template_pfsense_active.xml
Switch from to zabbix active agent items
2022-01-21 13:09:11 +01:00
Guillaume Hullin 71c8d6e963 Update template_pfsense_active.xml
removed need of global regex
2022-01-21 12:48:33 +01:00
Guillaume Hullin 3dd9bd78a9 delay updates
- removed delay definitions of 60s which should be the default value defined in Zabbix server
- convert a value to more readable form (exemple 3600 to 1h)
2022-01-21 12:31:32 +01:00
Guillaume Hullin 2586bc16e5 Update pfsense_zbx.php
Added certificate monitoring functions
2022-01-21 12:17:32 +01:00
Guillaume Hullin bd6045f9bd Update template_pfsense_active.xml
- added certificate monitoring
- added services monitoring selection based on macro with some default macro for iperf service (disabling monitoring) and PC/SC Smart Card Daemon (check if NOT running) because of a memory leak issue.
- removed delay definitions of 60s which should be the default value defined in Zabbix server
- removed history definitions of 27d which should be the default value defined in Zabbix server
- convert a few value to more readable form (exemple 3600 to 1h)
2022-01-21 12:17:14 +01:00
Guillaume Hullin b418256001 fast-forward to latest Futur-Tech version
This repo has been reset in order to be a fork of GuillaumeHullin/pfsense-zabbix-template which is a fork of rbicelli/pfsense-zabbix-template
2022-01-21 11:47:35 +01:00
Riccardo 950d21561b
Merge pull request #91 from SchiffelIT/master
fix ipsec_status con-id matching
2021-11-10 14:22:57 +01:00
Riccardo Bicelli 12358a0584 Issues #70, #81, #87 2021-11-09 22:58:18 +01:00
sschiffel 3ad0b109d1 fix ipsec_status con-id matching 2021-11-06 21:32:48 +01:00
Riccardo Bicelli cacc28be80 Added Zabbix 4 Templates 2021-07-19 22:22:31 +02:00
Riccardo Bicelli f2cc3a424a Fixed IPSec Status Conditions 2021-07-18 21:31:34 +02:00
Riccardo Bicelli 907c518a9e More typos 2021-07-13 09:30:08 +02:00
Riccardo Bicelli 55780b70f9 Fixed Typo in speedtest 2021-07-13 09:07:59 +02:00
Riccardo Bicelli 06bf4d7d63 Exported Templates from Zabbix 5.0 - Issue #80 2021-07-12 12:39:06 +02:00
Riccardo Bicelli 7c28500ad9 Speedtest: created temp file prior to write actual result file. 2021-07-12 12:34:56 +02:00
Riccardo Bicelli 8f15f006f4 Trying to fix Issue #76 2021-07-08 21:54:33 +02:00
Riccardo Bicelli 2e3873a265 Fixed Issue #79 2021-07-08 21:39:18 +02:00
Riccardo Bicelli bb50993763 Fixed issue #78 2021-07-08 17:00:59 +02:00
Riccardo Bicelli 8e340822e1 Fixed IPsec con_id 2021-07-07 23:04:45 +02:00
Riccardo Bicelli 5546a6c2b9 Fixed Speedtest Logic 2021-07-07 10:20:09 +02:00
Riccardo Bicelli f1d7ca8e5d Fixed Speedtest Logic 2021-07-07 10:05:25 +02:00
Riccardo Bicelli 5a36f380fd Fixed Speedtest logic 2021-07-07 09:54:57 +02:00
Riccardo Bicelli 2ed9d5791f typos 2021-07-06 23:32:43 +02:00
Riccardo Bicelli 9bd55db4be Improved Speedtest. 2021-07-06 23:03:29 +02:00
Riccardo Bicelli 9adb054faa Fixed IPSEC issues.
I almost blindly merged some PRs which supposed to solve problems, but broke things in IPSEC status reporting.
Fixed value mappings (lower cased).
Fixed conn ID numbering (in 2.4 IPSEC con id are enumerated con1000, con2000... and in 2.5 con100000, con200000)
2021-07-05 22:51:55 +02:00
Riccardo Bicelli e639c05c5e Typos 2021-07-05 19:31:48 +02:00
Riccardo Bicelli e3bddbd56b Typos 2021-07-05 17:58:34 +02:00
Riccardo Bicelli ebc9ae34fa Preliminary tests of Speedtest 2021-07-05 17:56:27 +02:00
Riccardo Bicelli d784c1f08a Merge branch 'master' into develop 2021-07-05 14:36:15 +02:00
Riccardo Bicelli 11784220d9 Fixed issues #72 and #76 2021-07-04 21:20:43 +02:00
Riccardo Bicelli d18056cf8a Fixed value mapper 2021-07-01 22:45:27 +02:00
Riccardo 6da03511b3
Merge pull request #74 from Relkci/master
Agent (Type 0) to Active Agent (Type 7)
2021-06-25 10:06:47 +02:00
Kent Ickler bb2c2cbe4a
Agent (Type 0) to Active Agent (Type 7)
corrected Agent (type 0) to Agent Active (Type 7) On Service Discovery Item Prototypes
2021-06-25 01:38:47 -06:00
Riccardo ea42900618
Merge pull request #71 from f87/master
OpenVPN Server TLS
2021-06-11 15:20:36 +02:00
f87 ba0281f08e Update pfsense_zbx.php
Не выполнялся поиск пользователе на серверах с TLS-Аутентификацией
2021-06-11 10:20:13 +03:00
Riccardo 8a1eb3830a
Merge pull request #69 from danjeman/master
Update pfsense_zbx.php
2021-03-19 14:17:19 +01:00
Dan Edwards 57324cf3a3
Update pfsense_zbx.php
Report correct Phase 1 status on non Carp enabled devices
2021-03-19 10:35:02 +00:00
Riccardo Bicelli 0f279ff310 Added DHCP Failover Monitoring, Renamed CARP section to HA 2021-01-23 16:54:32 +01:00
Riccardo Bicelli 7c9c5e66e5 Added checks in value maps for recent php versions, fixed p2p_tls service detection (Issue #36) 2021-01-20 15:07:57 +01:00
Riccardo Bicelli 3d6af95111 Fixed pfz_valuemap function 2021-01-18 23:12:46 +01:00
Riccardo Bicelli 3268a4445b Fixed gateway Status, Removed IPsec Phase2 Status (reqid mismatch) 2021-01-18 22:31:47 +01:00
Riccardo Bicelli 71aa881412 Added Radvd to list of service stopped on CARP Secondary 2021-01-18 17:29:21 +01:00
Riccardo Bicelli 9aa1b6c0d2 Corrected issue #58 2021-01-18 16:58:38 +01:00
Riccardo 2415ae4b42
Merge pull request #30 from yellowspace/master
rewritten pfz_interface_discovery a bit.
2020-06-29 11:01:59 +02:00
Lorenzo Perone c912044d80 rewritten pfz_interface_discovery a bit:
- added (default) option to skip unconfigured interfaces
- added (default) option to skip disabled interfaces
- added interfaces_all case to always return them all (as before)
- added a key IFNAMEJ for use in cases where jsonpath is needed (and dots are disturbing)
- removed manual json encoding and replaced with json_encode()
2020-06-26 19:40:03 +02:00
16 changed files with 7698 additions and 284 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*.backup
*.orig

View File

@ -4,14 +4,14 @@ This is a pfSense active template for Zabbix, based on Standard Agent and a php
This is forked from https://github.com/rbicelli/pfsense-zabbix-template for FWS needs
Tested with pfSense 2.4.x, Zabbix 4.0, Zabbix 5.0
Tested with pfSense 2.5.x, Zabbix 4.0, Zabbix 5.0, Zabbix 6.0
## What it does
**Template pfSense Active**
- Network interface Discovery and Monitoring with User Assigned Names
- Gateway Discovery and Monitoring (Gateway Status/RTT)
- Gateway Discovery and Monitoring (Gateway Status/RTT)
- OpenVPN Server Discovery and Monitoring (Server Status/Tunnel Status)
- OpenVPN Clients Discovery and Monitoring (Client Status/Tunnel Status)
- CARP Monitoring (Global CARP State)
@ -28,21 +28,31 @@ Tested with pfSense 2.4.x, Zabbix 4.0, Zabbix 5.0
- Discovery of IPsec Site-to-Site tunnels
- Monitoring tunnel status (Phase 1 and Phase 2)
**Template pfSense Active: Speedtest**
- Discovery of WAN Interfaces
- Perform speed tests and collect metrics
## Configuration
First copy the file pfsense_zbx.php to your pfsense box (e.g. to /root/scripts).
For example, from pfSense shell:
From **Diagnostics/Command Prompt** input this one-liner:
```bash
mkdir /root/zabbix
curl -o /root/zabbix/pfsense_zbx.php https://git.fws.fr/fws/pfsense-zabbix/raw/branch/master/pfsense_zbx.php
curl --create-dirs -o /root/scripts/pfsense_zbx.php https://raw.githubusercontent.com/rbicelli/pfsense-zabbix-template/master/pfsense_zbx.php
```
Then install package "Zabbix Agent 4" on your pfSense Box
Then, setup the system version cronjob with:
```bash
/usr/local/bin/php /root/scripts/pfsense_zbx.php sysversion_cron
```
Then install package "Zabbix Agent 5" (or "Zabbix Agent 6") on your pfSense Box
In Advanced Features-> User Parameters
@ -72,6 +82,46 @@ Possible values are:
This is useful when monitoring services which could stay stopped on CARP Backup Member.
## Setup Speedtest
For running speedtests on WAN interfaces you have to install the speedtest package.
From **Diagnostics/Command Prompt** input this commands:
```bash
pkg update && pkg install -y py38-speedtest-cli
```
Speedtest python package could be broken at the moment, so you could need an extra step, *only if manually executing speedtest results in an error*: download the latest version from package author's github repo.
```bash
curl -Lo /usr/local/lib/python3.8/site-packages/speedtest.py https://raw.githubusercontent.com/sivel/speedtest-cli/master/speedtest.py
```
For testing if speedtest is installed properly you can try it:
```bash
/usr/local/bin/speedtest
```
Then, setup the cronjob with:
```bash
/url/local/bin/php /root/scripts/pfsense_zbx.php speedtest_cron
```
Remember that you will need to install the package on *every* pfSense upgrade.
Speedtest template creates a cron job and check for entry everytime Zabbix requests its items. If you want to uninstall the cron jobs simply run, from **Diagnostics/Command Prompt**:
```bash
/url/local/bin/php /root/scripts/pfsense_zbx.php cron_cleanup
```
**NOTE**: When used in multiple gateways scenario, speedtest results are OK only with default gateway. This is a known behavior that must be fixed upstream.
## Credits
[Keenton Zabbix Template](https://github.com/keentonsas/zabbix-template-pfsense) for Zabbix Agent freeBSD part.

View File

@ -1,12 +1,18 @@
<?php
/***
pfsense_zbx.php - pfSense Zabbix Interface
Version 1.0.2 - 2021-01-18
Version 1.1.1 - 2021-10-24
Written by Riccardo Bicelli <r.bicelli@gmail.com>
This program is licensed under Apache 2.0 License
*/
//Some Useful defines
define('SPEEDTEST_INTERVAL', 8); //Speedtest Interval (in hours)
define('CRON_TIME_LIMIT', 300); // Time limit in seconds of speedtest and sysinfo
define('DEFAULT_TIME_LIMIT', 30); // Time limit in seconds otherwise
require_once('globals.inc');
require_once('functions.inc');
require_once('config.inc');
@ -26,7 +32,6 @@ require_once('pkg-utils.inc');
//For DHCP
//Testing function, for template creating purpose
function pfz_test(){
$line = "-------------------\n";
@ -90,40 +95,139 @@ function pfz_test(){
// Interface Discovery
// Improved performance
function pfz_interface_discovery() {
function pfz_interface_discovery($is_wan=false,$is_cron=false) {
$ifdescrs = get_configured_interface_with_descr(true);
$ifaces = get_interface_arr();
$ifcs=array();
$json_string = '[';
$if_ret=array();
$json_string = '{"data":[';
foreach ($ifdescrs as $ifname => $ifdescr){
$ifinfo = get_interface_info($ifname);
$ifinfo["description"] = $ifdescr;
$ifcs[$ifname] = $ifinfo;
}
$ifcs[$ifname] = $ifinfo;
}
foreach ($ifaces as $hwif) {
$json_string .= '{"{#IFNAME}":"' . $hwif . '"';
$ifdescr = $hwif;
$has_gw = false;
$is_vpn = false;
$has_public_ip = false;
foreach($ifcs as $ifc=>$ifinfo){
if ($ifinfo["hwif"] == $hwif){
$ifdescr = $ifinfo["description"];
if (array_key_exists("gateway",$ifinfo)) $has_gw=true;
// Issue #81 - https://stackoverflow.com/a/13818647/15093007
if (filter_var($ifinfo["ipaddr"], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) $has_public_ip=true;
if (strpos($ifinfo["if"],"ovpn")!==false) $is_vpn=true;
break;
}
}
$json_string .= ',"{#IFDESCR}":"' . $ifdescr . '"';
$json_string .= '},';
if ( ($is_wan==false) || (($is_wan==true) && (($has_gw==true) || ($has_public_ip==true)) && ($is_vpn==false)) ) {
$if_ret[]=$hwif;
$json_string .= '{"{#IFNAME}":"' . $hwif . '"';
$json_string .= ',"{#IFDESCR}":"' . $ifdescr . '"';
$json_string .= '},';
}
}
$json_string = rtrim($json_string,",");
$json_string .= "]";
if ($is_cron) return $if_ret;
echo $json_string;
}
//Interface Speedtest
function pfz_interface_speedtest_value($ifname, $value){
$tvalue = explode(".", $value);
if (count($tvalue)>1) {
$value = $tvalue[0];
$subvalue = $tvalue[1];
}
//If the interface has a gateway is considered WAN, so let's do the speedtest
$filename = "/tmp/speedtest-$ifname";
if (file_exists($filename)) {
$speedtest_data = json_decode(file_get_contents($filename), true) ?? [];
if (array_key_exists($value, $speedtest_data)) {
if ($subvalue == false)
echo $speedtest_data[$value];
else
echo $speedtest_data[$value][$subvalue];
}
}
}
// This is supposed to run via cron job
function pfz_speedtest_cron(){
require_once("services.inc");
$ifdescrs = get_configured_interface_with_descr(true);
$ifaces = get_interface_arr();
$pf_interface_name='';
$subvalue=false;
$ifcs = pfz_interface_discovery(true, true);
foreach ($ifcs as $ifname) {
foreach ($ifdescrs as $ifn => $ifd){
$ifinfo = get_interface_info($ifn);
if($ifinfo['hwif']==$ifname) {
$pf_interface_name = $ifn;
break;
}
}
pfz_speedtest_exec($ifname, $ifinfo['ipaddr']);
}
}
//installs a cron job for speedtests
function pfz_speedtest_cron_install($enable=true){
//Install Cron Job
$command = "/usr/local/bin/php " . __FILE__ . " speedtest_cron";
install_cron_job($command, $enable, $minute = "*/15", "*", "*", "*", "*", "root", true);
}
// 2023-02-26:
// Fixed issue #127
function pfz_speedtest_exec ($ifname, $ipaddr){
$filename = "/tmp/speedtest-$ifname";
$filetemp = "$filename.tmp";
$filerun = "/tmp/speedtest-run";
// Issue #82
// Sleep random delay in order to avoid problem when 2 pfSense on the same Internet line
sleep (rand ( 1, 90));
if ( (time()-filemtime($filename) > SPEEDTEST_INTERVAL * 3600) || (file_exists($filename)==false) ) {
// file is older than SPEEDTEST_INTERVAL
if ( (time()-filemtime($filerun) > 180 ) ) @unlink($filerun);
if (file_exists($filerun)==false) {
touch($filerun);
$st_command = "/usr/local/bin/speedtest --secure --source $ipaddr --json > $filetemp";
exec ($st_command);
rename($filetemp,$filename);
@unlink($filerun);
}
}
return true;
}
// OpenVPN Server Discovery
function pfz_openvpn_get_all_servers(){
$servers = openvpn_get_active_servers();
@ -161,7 +265,7 @@ function pfz_openvpn_servervalue($server_id,$valuekey){
$value = $server[$valuekey];
if ($valuekey=="status") {
if ( ($server['mode']=="server_user") || ($server['mode']=="server_tls_user") || ($server['mode']=="server_tls") ){
if ($value=="") $value="server_user_listening";
if ($value=="") $value="server_user_listening";
} else if ($server['mode']=="p2p_tls"){
// For p2p_tls, ensure we have one client, and return up if it's the case
if ($value=="")
@ -202,16 +306,19 @@ function pfz_openvpn_server_userdiscovery(){
$json_string = '[';
foreach ($servers as $server){
if ( ($server['mode']=='server_user') || ($server['mode']=='server_tls_user') ) {
if (is_array($server['conns'])) {
if ( ($server['mode']=='server_user') || ($server['mode']=='server_tls_user') || ($server['mode']=='server_tls') ) {
if (is_array($server['conns'])) {
$name = trim(preg_replace('/\w{3}(\d)?\:\d{4,5}/i', '', $server['name']));
foreach($server['conns'] as $conn) {
$json_string .= '{"{#SERVERID}":"' . $server['vpnid'] . '"';
$json_string .= ',"{#SERVERNAME}":"' . $name . '"';
$json_string .= ',"{#UNIQUEID}":"' . $server['vpnid'] . '+' . $conn['common_name'] . '"';
$json_string .= ',"{#USERID}":"' . $conn['common_name'] . '"';
$json_string .= '},';
$common_name = pfz_replacespecialchars($conn['common_name']);
$json_string .= '{"{#SERVERID}":"' . $server['vpnid'] . '"';
$json_string .= ',"{#SERVERNAME}":"' . $name . '"';
$json_string .= ',"{#UNIQUEID}":"' . $server['vpnid'] . '+' . $common_name . '"';
$json_string .= ',"{#USERID}":"' . $conn['common_name'] . '"';
$json_string .= '},';
}
}
}
@ -226,6 +333,7 @@ function pfz_openvpn_server_userdiscovery(){
// Get OpenVPN User Connected Value
function pfz_openvpn_server_uservalue($unique_id, $valuekey, $default=""){
$unique_id = pfz_replacespecialchars($unique_id,true);
$atpos=strpos($unique_id,'+');
$server_id = substr($unique_id,0,$atpos);
$user_id = substr($unique_id,$atpos+1);
@ -262,6 +370,20 @@ function pfz_openvpn_clientdiscovery() {
echo $json_string;
}
function pfz_replacespecialchars($inputstr,$reverse=false){
$specialchars = ",',\",`,*,?,[,],{,},~,$,!,&,;,(,),<,>,|,#,@,0x0a";
$specialchars = explode(",",$specialchars);
$resultstr = $inputstr;
for ($n=0;$n<count($specialchars);$n++){
if ($reverse==false)
$resultstr = str_replace($specialchars[$n],'%%' . $n . '%',$resultstr);
else
$resultstr = str_replace('%%' . $n . '%',$specialchars[$n],$resultstr);
}
return ($resultstr);
}
function pfz_openvpn_clientvalue($client_id, $valuekey, $default="none"){
$clients = openvpn_get_active_clients();
@ -327,8 +449,8 @@ function pfz_service_value($name,$value){
//List of service which are stopped on CARP Slave.
//For now this is the best way i found for filtering out the triggers
//Waiting for a way in Zabbix to use Global Regexp in triggers with items discovery
$stopped_on_carp_slave = array("haproxy","openvpn.","openvpn");
$stopped_on_carp_slave = array("haproxy","radvd","openvpn.","openvpn","avahi");
foreach ($services as $service){
$namecfr = $service["name"];
$carpcfr = $service["name"];
@ -352,31 +474,33 @@ function pfz_service_value($name,$value){
$status = get_service_status($service);
if ($status=="") $status = 0;
echo $status;
break;
return;
case "name":
echo $namecfr;
break;
return;
case "enabled":
if (is_service_enabled($service['name']))
echo 1;
else
echo 0;
break;
return;
case "run_on_carp_slave":
if (in_array($carpcfr,$stopped_on_carp_slave))
echo 0;
else
echo 1;
break;
default:
return;
default:
echo $service[$value];
break;
return;
}
}
}
echo 0;
}
@ -411,9 +535,14 @@ function pfz_gw_value($gw, $valuekey) {
$gws = return_gateways_status(true);
if(array_key_exists($gw,$gws)) {
$value = $gws[$gw][$valuekey];
if ($valuekey=="status")
if ($valuekey=="status") {
//Issue #70: Gateway Forced Down
if ($gws[$gw]["substatus"]<>"none")
$value = $gws[$gw]["substatus"];
$value = pfz_valuemap("gateway.status", $value);
echo $value;
}
echo $value;
}
}
@ -441,8 +570,7 @@ function pfz_ipsec_discovery_ph1(){
}
function pfz_ipsec_ph1($ikeid,$valuekey){
function pfz_ipsec_ph1($ikeid,$valuekey){
// Get Value from IPsec Phase 1 Configuration
// If Getting "disabled" value only check item presence in config array
@ -538,28 +666,45 @@ function pfz_ipsec_status($ikeid,$reqid=-1,$valuekey='state'){
require_once("ipsec.inc");
global $config;
init_config_arr(array('ipsec', 'phase1'));
$a_phase1 = &$config['ipsec']['phase1'];
$conmap = array();
foreach ($a_phase1 as $ph1ent) {
if (function_exists('get_ipsecifnum')) {
if (get_ipsecifnum($ph1ent['ikeid'], 0)) {
$cname = "con" . get_ipsecifnum($ph1ent['ikeid'], 0);
} else {
$cname = "con{$ph1ent['ikeid']}00000";
}
} else{
$cname = ipsec_conid($ph1ent);
}
$conmap[$cname] = $ph1ent['ikeid'];
}
$status = ipsec_list_sa();
$ipsecconnected = array();
$carp_status = pfz_carp_status(false);
//Phase-Status match borrowed from status_ipsec.php
if (is_array($status)) {
//Phase-Status match borrowed from status_ipsec.php
if (is_array($status)) {
foreach ($status as $l_ikeid=>$ikesa) {
if(isset($ikesa['con-id'])){
if (isset($ikesa['con-id'])) {
$con_id = substr($ikesa['con-id'], 3);
}else{
$con_id = filter_var($l_ikeid, FILTER_SANITIZE_NUMBER_INT);
} else {
$con_id = filter_var($ikeid, FILTER_SANITIZE_NUMBER_INT);
}
$con_name = "con" . $con_id;
if ($ikesa['version'] == 1) {
$ph1idx = substr($con_id, 0, strrpos(substr($con_id, 0, -1), '00'));
$ph1idx = $conmap[$con_name];
$ipsecconnected[$ph1idx] = $ph1idx;
} else {
if (!ipsec_ikeid_used($con_id)) {
// probably a v2 with split connection then
$ph1idx = substr($con_id, 0, strrpos(substr($con_id, 0, -1), '00'));
$ph1idx = $conmap[$con_name];
$ipsecconnected[$ph1idx] = $ph1idx;
} else {
$ipsecconnected[$con_id] = $ph1idx = $con_id;
@ -570,7 +715,7 @@ function pfz_ipsec_status($ikeid,$reqid=-1,$valuekey='state'){
// Asking for Phase2 Status Value
foreach ($ikesa['child-sas'] as $childsas) {
if ($childsas['reqid']==$reqid) {
if ($childsas['state'] == 'REKEYED') {
if (strtolower($childsas['state']) == 'rekeyed') {
//if state is rekeyed go on
$tmp_value = $childsas[$valuekey];
} else {
@ -587,20 +732,56 @@ function pfz_ipsec_status($ikeid,$reqid=-1,$valuekey='state'){
}
}
}
switch($valuekey) {
case 'state':
$value = pfz_valuemap('ipsec.state', strtolower($tmp_value));
if ($carp_status != 0)
$value = $value + (10 * ($carp_status-1));
if ($carp_status!=0) $value = $value + (10 * ($carp_status-1));
break;
default:
$value = $tmp_value;
break;
}
// print_r($ikesa);
return $value;
}
// Temperature sensors Discovery
function pfz_temperature_sensors_discovery(){
$json_string = '{"data":[';
$sensors = [];
exec("sysctl -a | grep temperature | cut -d ':' -f 1", $sensors, $code);
if ($code != 0) {
echo "";
return;
} else {
foreach ($sensors as $sensor) {
$json_string .= '{"{#SENSORID}":"' . $sensor . '"';
$json_string .= '},';
}
}
$json_string = rtrim($json_string,",");
$json_string .= "]}";
echo $json_string;
}
// Temperature sensor get value
function pfz_get_temperature($sensorid){
exec("sysctl '$sensorid' | cut -d ':' -f 2", $value, $code);
if ($code != 0 or count($value)!=1) {
echo "";
return;
} else {
echo trim($value[0]);
}
}
function pfz_carp_status($echo = true){
@ -652,6 +833,182 @@ function pfz_carp_status($echo = true){
}
// DHCP Checks (copy of status_dhcp_leases.php, waiting for pfsense 2.5)
function pfz_remove_duplicate($array, $field) {
foreach ($array as $sub) {
$cmp[] = $sub[$field];
}
$unique = array_unique(array_reverse($cmp, true));
foreach ($unique as $k => $rien) {
$new[] = $array[$k];
}
return $new;
}
// Get DHCP Arrays (copied from status_dhcp_leases.php, waiting for pfsense 2.5, in order to use system_get_dhcpleases();)
function pfz_dhcp_get($valuekey) {
require_once("config.inc");
$leasesfile = "{$g['dhcpd_chroot_path']}/var/db/dhcpd.leases";
$awk = "/usr/bin/awk";
/* this pattern sticks comments into a single array item */
$cleanpattern = "'{ gsub(\"#.*\", \"\");} { gsub(\";\", \"\"); print;}'";
/* We then split the leases file by } */
$splitpattern = "'BEGIN { RS=\"}\";} {for (i=1; i<=NF; i++) printf \"%s \", \$i; printf \"}\\n\";}'";
/* stuff the leases file in a proper format into a array by line */
@exec("/bin/cat {$leasesfile} 2>/dev/null| {$awk} {$cleanpattern} | {$awk} {$splitpattern}", $leases_content);
$leases_count = count($leases_content);
@exec("/usr/sbin/arp -an", $rawdata);
$leases = [];
$pools = [];
$i = 0;
$l = 0;
$p = 0;
foreach ($leases_content as $lease) {
/* split the line by space */
$data = explode(" ", $lease);
/* walk the fields */
$f = 0;
$fcount = count($data);
/* with less than 20 fields there is nothing useful */
if ($fcount < 20) {
$i++;
continue;
}
while ($f < $fcount) {
switch ($data[$f]) {
case "failover":
$pools[$p]['name'] = trim($data[$f+2], '"');
$pools[$p]['name'] = "{$pools[$p]['name']} (" . convert_friendly_interface_to_friendly_descr(substr($pools[$p]['name'], 5)) . ")";
$pools[$p]['mystate'] = $data[$f+7];
$pools[$p]['peerstate'] = $data[$f+14];
$pools[$p]['mydate'] = $data[$f+10];
$pools[$p]['mydate'] .= " " . $data[$f+11];
$pools[$p]['peerdate'] = $data[$f+17];
$pools[$p]['peerdate'] .= " " . $data[$f+18];
$p++;
$i++;
continue 3;
case "lease":
$leases[$l]['ip'] = $data[$f+1];
$leases[$l]['type'] = $dynamic_string;
$f = $f+2;
break;
case "starts":
$leases[$l]['start'] = $data[$f+2];
$leases[$l]['start'] .= " " . $data[$f+3];
$f = $f+3;
break;
case "ends":
if ($data[$f+1] == "never") {
// Quote from dhcpd.leases(5) man page:
// If a lease will never expire, date is never instead of an actual date.
$leases[$l]['end'] = gettext("Never");
$f = $f+1;
} else {
$leases[$l]['end'] = $data[$f+2];
$leases[$l]['end'] .= " " . $data[$f+3];
$f = $f+3;
}
break;
case "tstp":
$f = $f+3;
break;
case "tsfp":
$f = $f+3;
break;
case "atsfp":
$f = $f+3;
break;
case "cltt":
$f = $f+3;
break;
case "binding":
switch ($data[$f+2]) {
case "active":
$leases[$l]['act'] = $active_string;
break;
case "free":
$leases[$l]['act'] = $expired_string;
$leases[$l]['online'] = $offline_string;
break;
case "backup":
$leases[$l]['act'] = $reserved_string;
$leases[$l]['online'] = $offline_string;
break;
}
$f = $f+1;
break;
case "next":
/* skip the next binding statement */
$f = $f+3;
break;
case "rewind":
/* skip the rewind binding statement */
$f = $f+3;
break;
case "hardware":
$leases[$l]['mac'] = $data[$f+2];
/* check if it's online and the lease is active */
if (in_array($leases[$l]['ip'], $arpdata_ip)) {
$leases[$l]['online'] = $online_string;
} else {
$leases[$l]['online'] = $offline_string;
}
$f = $f+2;
break;
case "client-hostname":
if ($data[$f+1] <> "") {
$leases[$l]['hostname'] = preg_replace('/"/', '', $data[$f+1]);
} else {
$hostname = gethostbyaddr($leases[$l]['ip']);
if ($hostname <> "") {
$leases[$l]['hostname'] = $hostname;
}
}
$f = $f+1;
break;
case "uid":
$f = $f+1;
break;
}
$f++;
}
$l++;
$i++;
/* slowly chisel away at the source array */
array_shift($leases_content);
}
/* remove duplicate items by mac address */
if (count($leases) > 0) {
$leases = pfz_remove_duplicate($leases, "ip");
}
if (count($pools) > 0) {
$pools = pfz_remove_duplicate($pools, "name");
asort($pools);
}
switch ($valuekey){
case "pools":
return $pools;
break;
case "failover":
return $failover;
break;
case "leases":
default:
return $leases;
}
}
function pfz_dhcpfailover_discovery(){
//System functions regarding DHCP Leases will be available in the upcoming release of pfSense, so let's wait
require_once("system.inc");
@ -671,6 +1028,29 @@ function pfz_dhcpfailover_discovery(){
echo $json_string;
}
function pfz_dhcp_check_failover(){
// Check DHCP Failover Status
// Returns number of failover pools which state is not normal or
// different than peer state
$failover = pfz_dhcp_get("failover");
$ret = 0;
foreach ($failover as $f){
if ( ($f["mystate"]!="normal") || ($f["mystate"]!=$f["peerstate"])) {
$ret++;
}
}
return $ret;
}
function pfz_dhcp($section, $valuekey=""){
switch ($section){
case "failover":
echo pfz_dhcp_check_failover();
break;
default:
}
}
//Packages
function pfz_packages_uptodate(){
require_once("pkg-utils.inc");
@ -687,40 +1067,152 @@ function pfz_packages_uptodate(){
return $ret;
}
function pfz_sysversion_cron_install($enable=true){
//Install Cron Job
$command = "/usr/local/bin/php " . __FILE__ . " systemcheck_cron";
install_cron_job($command, $enable, $minute = "0", "9,21", "*", "*", "*", "root", true);
}
// System information takes a long time to get on slower systems.
// So it is saved via a cronjob.
function pfz_sysversion_cron (){
$filename = "/tmp/sysversion.json";
$upToDate = pfz_packages_uptodate();
$sysVersion = get_system_pkg_version();
$sysVersion["packages_update"] = $upToDate;
$sysVersionJson = json_encode($sysVersion);
if (file_exists($filename)) {
if ((time()-filemtime($filename) > CRON_TIME_LIMIT ) ) {
@unlink($filename);
}
}
if (file_exists($filename)==false) {
touch($filename);
file_put_contents($filename, $sysVersionJson);
}
return true;
}
//System Information
function pfz_get_system_value($section){
$filename = "/tmp/sysversion.json";
if(file_exists($filename)) {
$sysVersion = json_decode(file_get_contents($filename), true);
} else {
if($section == "new_version_available") {
echo "0";
} else {
echo "error: cronjob not installed. Run \"php pfsense_zbx.php sysversion_cron\"";
}
}
switch ($section){
case "version":
echo( get_system_pkg_version()['version']);
echo( $sysVersion['version']);
break;
case "installed_version":
echo( get_system_pkg_version()['installed_version']);
echo($sysVersion['installed_version']);
break;
case "new_version_available":
$pkgver = get_system_pkg_version();
if ($pkgver['version']==$pkgver['installed_version'])
if ($sysVersion['version']==$sysVersion['installed_version'])
echo "0";
else
echo "1";
break;
case "packages_update":
echo pfz_packages_uptodate();
echo $sysVersion["packages_update"];
break;
}
}
//S.M.A.R.T Status
// Taken from /usr/local/www/widgets/widgets/smart_status.widget.php
function pfz_get_smart_status(){
$devs = get_smart_drive_list();
$status = 0;
foreach ($devs as $dev) { ## for each found drive do
$smartdrive_is_displayed = true;
$dev_ident = exec("diskinfo -v /dev/$dev | grep ident | awk '{print $1}'"); ## get identifier from drive
$dev_state = trim(exec("smartctl -H /dev/$dev | awk -F: '/^SMART overall-health self-assessment test result/ {print $2;exit}
/^SMART Health Status/ {print $2;exit}'")); ## get SMART state from drive
switch ($dev_state) {
case "PASSED":
case "OK":
//OK
$status=0;
break;
case "":
//Unknown
$status=2;
return $status;
break;
default:
//Error
$status=1;
return $status;
break;
}
}
echo $status;
}
// Certificats validity date
function pfz_get_cert_date($valuekey){
global $config;
// Contains a list of refs that were revoked and should not be considered
$revoked_cert_refs = [];
foreach ($config["crl"] as $crl) {
foreach ($crl["cert"] as $revoked_cert) {
$revoked_cert_refs[] = $revoked_cert["refid"];
}
}
$value = 0;
foreach (array("cert", "ca") as $cert_type) {
switch ($valuekey){
case "validFrom.max":
foreach ($config[$cert_type] as $cert) {
if ( ! in_array($cert['refid'], $revoked_cert_refs) ) {
$certinfo = openssl_x509_parse(base64_decode($cert["crt"]));
if ($value == 0 or $value < $certinfo['validFrom_time_t']) $value = $certinfo['validFrom_time_t'];
}
}
break;
case "validTo.min":
foreach ($config[$cert_type] as $cert) {
if ( ! in_array($cert['refid'], $revoked_cert_refs) ) {
$certinfo = openssl_x509_parse(base64_decode($cert["crt"]));
if ($value == 0 or $value > $certinfo['validTo_time_t']) $value = $certinfo['validTo_time_t'];
}
}
break;
}
}
echo $value;
}
// File is present
function pfz_file_exists($filename) {
if (file_exists($filename))
echo "1";
else
echo "0";
}
// Value mappings
// Each value map is represented by an associative array
function pfz_valuemap($valuename, $value, $default="0"){
switch ($valuename){
switch ($valuename){
case "openvpn.server.status":
$valuemap = array(
"down" => "0",
"up" => "1",
"connected (success)" => "1",
"none" => "2",
"reconnecting; ping-restart" => "3",
"waiting" => "4",
@ -730,6 +1222,7 @@ function pfz_valuemap($valuename, $value, $default="0"){
case "openvpn.client.status":
$valuemap = array(
"up" => "1",
"connected (success)" => "1",
"down" => "0",
"none" => "0",
"reconnecting; ping-restart" => "2");
@ -746,6 +1239,7 @@ function pfz_valuemap($valuename, $value, $default="0"){
case "gateway.status":
$valuemap = array(
"online" => "0",
"none" => "0",
"loss" => "1",
"highdelay" => "2",
@ -797,9 +1291,11 @@ function pfz_valuemap($valuename, $value, $default="0"){
}
if (array_key_exists($value, $valuemap))
return $valuemap[$value];
if (is_array($valuemap)) {
$value = strtolower($value);
if (array_key_exists($value, $valuemap))
return $valuemap[$value];
}
return $default;
}
@ -809,6 +1305,9 @@ function pfz_discovery($section){
case "gw":
pfz_gw_discovery();
break;
case "wan":
pfz_interface_discovery(true);
break;
case "openvpn_server":
pfz_openvpn_serverdiscovery();
break;
@ -833,11 +1332,23 @@ function pfz_discovery($section){
case "dhcpfailover":
pfz_dhcpfailover_discovery();
break;
}
case "temperature_sensors":
pfz_temperature_sensors_discovery();
break;
}
}
//Main Code
switch (strtolower($argv[1])){
$mainArgument = strtolower($argv[1]);
if(substr($mainArgument, -4, 4) == "cron") {
// A longer time limit for cron tasks.
set_time_limit(CRON_TIME_LIMIT);
} else {
// Set a timeout to prevent a blocked call from stopping all future calls.
set_time_limit(DEFAULT_TIME_LIMIT);
}
switch ($mainArgument){
case "discovery":
pfz_discovery($argv[2]);
break;
@ -847,6 +1358,10 @@ switch (strtolower($argv[1])){
case "gw_status":
pfz_gw_rawstatus();
break;
case "if_speedtest_value":
pfz_speedtest_cron_install();
pfz_interface_speedtest_value($argv[2],$argv[3]);
break;
case "openvpn_servervalue":
pfz_openvpn_servervalue($argv[2],$argv[3]);
break;
@ -868,6 +1383,10 @@ switch (strtolower($argv[1])){
case "if_name":
pfz_get_if_name($argv[2]);
break;
case "sysversion_cron":
pfz_sysversion_cron_install();
pfz_sysversion_cron();
break;
case "system":
pfz_get_system_value($argv[2]);
break;
@ -877,6 +1396,29 @@ switch (strtolower($argv[1])){
case "ipsec_ph2":
pfz_ipsec_ph2($argv[2],$argv[3]);
break;
case "dhcp":
pfz_dhcp($argv[2],$argv[3]);
break;
case "file_exists":
pfz_file_exists($argv[2]);
break;
case "speedtest_cron":
pfz_speedtest_cron_install();
pfz_speedtest_cron();
break;
case "cron_cleanup":
pfz_speedtest_cron_install(false);
pfz_sysversion_cron_install(false);
break;
case "smart_status":
pfz_get_smart_status();
break;
case "cert_date":
pfz_get_cert_date($argv[2]);
break;
case "temperature":
pfz_get_temperature($argv[2]);
break;
default:
pfz_test();
}

1571
pfsense_zbx_rc.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.0</version>
<date>2021-01-18T15:00:52Z</date>
<date>2021-07-04T19:16:51Z</date>
<groups>
<group>
<name>Templates/Network Devices</name>
@ -21,9 +21,6 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
</group>
</groups>
<applications>
<application>
<name>CARP</name>
</application>
<application>
<name>CPU</name>
</application>
@ -33,6 +30,9 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<application>
<name>Gateways</name>
</application>
<application>
<name>HA</name>
</application>
<application>
<name>Memory</name>
</application>
@ -271,7 +271,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>CARP</name>
<name>HA</name>
</application>
</applications>
<valuemap>
@ -745,7 +745,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>CARP</name>
<name>HA</name>
</application>
</applications>
<valuemap>
@ -774,6 +774,65 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<verify_host>0</verify_host>
<master_item/>
</item>
<item>
<name>DHCP Failover Pool Problems</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[dhcp,failover]</key>
<delay>120s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>This value indicates, in a HA scenario, if DHCP failover pool partners are out of sync.</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>HA</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<master_item/>
</item>
<item>
<name>Gateway Status Raw</name>
<type>7</type>
@ -2466,7 +2525,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<publickey/>
<privatekey/>
<port/>
<description>quantité de mémoire en cours d'utilisation par les processus</description>
<description>Memory used by processes</description>
<inventory_link>0</inventory_link>
<applications>
<application>
@ -2645,7 +2704,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<publickey/>
<privatekey/>
<port/>
<description>quantité de mémoire utilisée pour mettre des données en cache</description>
<description>amount of memory used to cache data</description>
<inventory_link>0</inventory_link>
<applications>
<application>
@ -2704,7 +2763,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<publickey/>
<privatekey/>
<port/>
<description>quantité de mémoire complètement libre et prête a être utilisée directement.</description>
<description>amount of memory completely free and ready to be used directly.</description>
<inventory_link>0</inventory_link>
<applications>
<application>
@ -2763,7 +2822,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<publickey/>
<privatekey/>
<port/>
<description>quantité de mémoire qui contient des données qui ne sont plus utilisées (peut être directement libéré si besoin)</description>
<description>amount of memory that contains data that is no longer used (can be directly freed if needed)</description>
<inventory_link>0</inventory_link>
<applications>
<application>
@ -3065,7 +3124,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<publickey/>
<privatekey/>
<port/>
<description>quantité de mémoire utilisée par le kernel, ne peut être ni déchargée en swap, ni compressée.</description>
<description>amount of memory used by the kernel, can neither be unloaded in swap, nor compressed.</description>
<inventory_link>0</inventory_link>
<applications>
<application>
@ -4420,14 +4479,21 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
<conditions>
<condition>
<macro>{#SERVICE}</macro>
<value>@pfSense service names for discovery</value>
<operator>8</operator>
<formulaid>A</formulaid>
</condition>
</conditions>
</filter>
<lifetime>30d</lifetime>
<description/>
<item_prototypes>
<item_prototype>
<name>Service {#DESCRIPTION} enabled on CARP Slave</name>
<type>0</type>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[service_value,{#SERVICE},run_on_carp_slave]</key>
@ -4489,7 +4555,7 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
</item_prototype>
<item_prototype>
<name>Service {#DESCRIPTION} Status</name>
<type>0</type>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[service_value,{#SERVICE},status]</key>
@ -5254,6 +5320,22 @@ or&#13;
<dependencies/>
<tags/>
</trigger>
<trigger>
<expression>{Template pfSense Active:pfsense.value[carp_status].last()}&gt;2</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>DHCP Failover Problems on {HOST.NAME}</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url>https://docs.netgate.com/pfsense/en/latest/troubleshooting/ha-dhcp-failover.html</url>
<status>0</status>
<priority>4</priority>
<description>One or more DHCP Pools are experiencing failover problems. This could potentially cause other problems in yourr network.</description>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
<trigger>
<expression>{Template pfSense Active:system.uname.diff(0)}&gt;0</expression>
<recovery_mode>0</recovery_mode>
@ -5392,7 +5474,7 @@ or&#13;
<url/>
<status>0</status>
<priority>1</priority>
<description>Notify of new version of packages are available</description>
<description>New version of packages are available</description>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.0</version>
<date>2021-01-18T15:02:45Z</date>
<date>2021-01-18T21:30:16Z</date>
<groups>
<group>
<name>Templates/Network Devices</name>
@ -504,188 +504,6 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
<lifetime>30d</lifetime>
<description>Discovery of IPsec Phase 2</description>
<item_prototypes>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Byte Received</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[ipsec_ph2,{#EXTID},status.bytes-in]</key>
<delay>60s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>b</units>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>IPsec Tunnel Phase 2 Protocol</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<application_prototypes/>
<master_item/>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Byte Sent</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[ipsec_ph2,{#EXTID},status.bytes-out]</key>
<delay>60s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>b</units>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>IPsec Tunnel Phase 2 Protocol</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<application_prototypes/>
<master_item/>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Status</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[ipsec_ph2,{#EXTID},status]</key>
<delay>60s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>IPsec Tunnel Phase 2 Protocol</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Phase 2 Status</name>
</valuemap>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<application_prototypes/>
<master_item/>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Enabled</name>
<type>7</type>
@ -1025,27 +843,6 @@ https://github.com/rbicelli/pfsense-zabbix-template</description>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec Phase 2 Status</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Down</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>Installed</newvalue>
</mapping>
<mapping>
<value>2</value>
<newvalue>Rekeyed</newvalue>
</mapping>
<mapping>
<value>10</value>
<newvalue>Down on CARP Secondary</newvalue>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec Protocol</name>
<mappings>

View File

@ -0,0 +1,332 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>4.0</version>
<date>2021-07-05T15:51:20Z</date>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<templates>
<template>
<template>pfSense Active Speedtest</template>
<name>pfSense Active: Speedtest</name>
<description>Extension for pfSense Active Template.&#13;
Executes Speedtests on WAN Interfaces.&#13;
&#13;
Requires pfsense_zbx.php installed to pfSense Box.&#13;
Version 1.0.5&#13;
&#13;
https://github.com/rbicelli/pfsense-zabbix-template</description>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
<items/>
<discovery_rules>
<discovery_rule>
<name>WAN Interfaces</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.discovery[wan]</key>
<delay>300s</delay>
<status>0</status>
<allowed_hosts/>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<filter>
<evaltype>0</evaltype>
<formula/>
<conditions/>
</filter>
<lifetime>30d</lifetime>
<description>Discover WAN Interfaces</description>
<item_prototypes>
<item_prototype>
<name>Speedtest Download on {#IFDESCR}</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[if_speedtest_value,{#IFNAME},download]</key>
<delay>3600s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units>bps</units>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>Download speed determined by Ookla Speedtest package</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<application_prototypes/>
<master_item/>
</item_prototype>
<item_prototype>
<name>Speedtest Ping on {#IFDESCR}</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[if_speedtest_value,{#IFNAME},ping]</key>
<delay>3600s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units>ms</units>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>Ping determined by Ookla Speedtest package</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<application_prototypes/>
<master_item/>
</item_prototype>
<item_prototype>
<name>Speedtest Upload on {#IFDESCR}</name>
<type>7</type>
<snmp_community/>
<snmp_oid/>
<key>pfsense.value[if_speedtest_value,{#IFNAME},upload]</key>
<delay>3600s</delay>
<history>90d</history>
<trends>365d</trends>
<status>0</status>
<value_type>0</value_type>
<allowed_hosts/>
<units>bps</units>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<params/>
<ipmi_sensor/>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description>Ping determined by Ookla Speedtest package</description>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
<preprocessing/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<output_format>0</output_format>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
<application_prototypes/>
<master_item/>
</item_prototype>
</item_prototypes>
<trigger_prototypes/>
<graph_prototypes>
<graph_prototype>
<name>Speedtest metrics on {#IFDESCR}</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>0</drawtype>
<color>199C0D</color>
<yaxisside>0</yaxisside>
<calc_fnc>7</calc_fnc>
<type>0</type>
<item>
<host>pfSense Active Speedtest</host>
<key>pfsense.value[if_speedtest_value,{#IFNAME},download]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>FFFF00</color>
<yaxisside>0</yaxisside>
<calc_fnc>7</calc_fnc>
<type>0</type>
<item>
<host>pfSense Active Speedtest</host>
<key>pfsense.value[if_speedtest_value,{#IFNAME},upload]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>0</drawtype>
<color>0040FF</color>
<yaxisside>0</yaxisside>
<calc_fnc>7</calc_fnc>
<type>0</type>
<item>
<host>pfSense Active Speedtest</host>
<key>pfsense.value[if_speedtest_value,{#IFNAME},ping]</key>
</item>
</graph_item>
</graph_items>
</graph_prototype>
</graph_prototypes>
<host_prototypes/>
<jmx_endpoint/>
<timeout>3s</timeout>
<url/>
<query_fields/>
<posts/>
<status_codes>200</status_codes>
<follow_redirects>1</follow_redirects>
<post_type>0</post_type>
<http_proxy/>
<headers/>
<retrieve_mode>0</retrieve_mode>
<request_method>0</request_method>
<allow_traps>0</allow_traps>
<ssl_cert_file/>
<ssl_key_file/>
<ssl_key_password/>
<verify_peer>0</verify_peer>
<verify_host>0</verify_host>
</discovery_rule>
</discovery_rules>
<httptests/>
<macros/>
<templates/>
<screens/>
</template>
</templates>
</zabbix_export>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,301 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-07-12T10:36:28Z</date>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<templates>
<template>
<template>Template pfSense Active IPsec</template>
<name>pfSense Active: IPsec</name>
<description>Extension for pfSense Active Template.&#13;
Monitor IPsec VPN.&#13;
&#13;
Requires pfsense_zbx.php installed to pfSense Box.&#13;
Version 1.0.2&#13;
&#13;
https://github.com/rbicelli/pfsense-zabbix-template</description>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<discovery_rules>
<discovery_rule>
<name>IPsec Phase 1 Discovery</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.discovery[ipsec_ph1]</key>
<delay>1200s</delay>
<description>Discovery of IPsec Phase 1</description>
<item_prototypes>
<item_prototype>
<name>IPsec Tunnel {#IKEID} {#NAME} Tunnel Enabled</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph1,{#IKEID},disabled]</key>
<delay>120s</delay>
<description>IPsec Phase 1 Tunnel Mode</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Enabled</name>
</valuemap>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID} {#NAME} IKE Type</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph1,{#IKEID},iketype]</key>
<delay>600s</delay>
<description>IPsec Phase 1 IKE Type</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec IKE Type</name>
</valuemap>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID} {#NAME} Tunnel Mode</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph1,{#IKEID},mode]</key>
<delay>600s</delay>
<description>IPsec Phase 1 Tunnel Mode</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Tunnel Mode</name>
</valuemap>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID} {#NAME} Protocol</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph1,{#IKEID},protocol]</key>
<delay>600s</delay>
<description>IPsec Phase 1 Protocol</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Protocol</name>
</valuemap>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID} {#NAME} Remote Gateway</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph1,{#IKEID},remote-gateway]</key>
<delay>600s</delay>
<trends>0</trends>
<value_type>TEXT</value_type>
<description>IPsec Phase 1 Remote Gateway</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID} {#NAME} Phase 1 Status</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph1,{#IKEID},status]</key>
<delay>60s</delay>
<description>IPsec Phase 1 Tunnel Mode</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Phase 1 Status</name>
</valuemap>
</item_prototype>
</item_prototypes>
<trigger_prototypes>
<trigger_prototype>
<expression>{Template pfSense Active IPsec:pfsense.value[ipsec_ph1,{#IKEID},disabled].last()}=0 and {Template pfSense Active IPsec:pfsense.value[ipsec_ph1,{#IKEID},status].last()}&lt;&gt;1 and {Template pfSense Active IPsec:pfsense.value[ipsec_ph1,{#IKEID},status].last()}&lt;10</expression>
<name>IPsec Tunnel {#IKEID} ({#NAME}) Not Connected</name>
<priority>HIGH</priority>
<description>IPsec Phase 1 is not connected.</description>
</trigger_prototype>
</trigger_prototypes>
</discovery_rule>
<discovery_rule>
<name>IPsec Phase 2 Discovery</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.discovery[ipsec_ph2]</key>
<delay>1200s</delay>
<description>Discovery of IPsec Phase 2</description>
<item_prototypes>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Enabled</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph2,{#UNIQID},disabled]</key>
<delay>120s</delay>
<description>IPsec Tunnel Phase 2 Protocol</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Enabled</name>
</valuemap>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Life Time</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph2,{#UNIQID},lifetime]</key>
<delay>600s</delay>
<units>s</units>
<description>IPsec Tunnel Phase 2 Life Time</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Mode</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph2,{#UNIQID},mode]</key>
<delay>600s</delay>
<description>IPsec Tunnel Phase 2 Mode</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Protocol</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[ipsec_ph2,{#UNIQID},protocol]</key>
<delay>600s</delay>
<description>IPsec Tunnel Phase 2 Protocol</description>
<applications>
<application>
<name>IPsec</name>
</application>
</applications>
<valuemap>
<name>pfSense IPsec Phase 2 Protocol</name>
</valuemap>
</item_prototype>
</item_prototypes>
</discovery_rule>
</discovery_rules>
</template>
</templates>
<value_maps>
<value_map>
<name>pfSense IPsec Enabled</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Yes</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>No</newvalue>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec IKE Type</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Auto</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>IKE v1</newvalue>
</mapping>
<mapping>
<value>2</value>
<newvalue>IKE v2</newvalue>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec Phase 1 Status</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Down</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>Established</newvalue>
</mapping>
<mapping>
<value>2</value>
<newvalue>Connecting</newvalue>
</mapping>
<mapping>
<value>10</value>
<newvalue>Down on CARP Secondary</newvalue>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec Phase 2 Protocol</name>
<mappings>
<mapping>
<value>1</value>
<newvalue>ESP</newvalue>
</mapping>
<mapping>
<value>2</value>
<newvalue>AH</newvalue>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec Protocol</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Dual Stack (IPv4 &amp; IPv6)</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>IPv4</newvalue>
</mapping>
<mapping>
<value>2</value>
<newvalue>IPv6</newvalue>
</mapping>
</mappings>
</value_map>
<value_map>
<name>pfSense IPsec Tunnel Mode</name>
<mappings>
<mapping>
<value>0</value>
<newvalue>Main</newvalue>
</mapping>
<mapping>
<value>1</value>
<newvalue>Aggressive</newvalue>
</mapping>
</mappings>
</value_map>
</value_maps>
</zabbix_export>

View File

@ -0,0 +1,168 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-07-12T10:37:03Z</date>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<templates>
<template>
<template>Template pfSense Active OpenVPN Server User Auth</template>
<name>pfSense Active: OpenVPN Server User Auth</name>
<description>Extension for pfSense Active Template.&#13;
Monitor client Connections of OpenVPN Server.&#13;
&#13;
Requires pfsense_zbx.php installed to pfSense Box.&#13;
Version 1.0.2&#13;
&#13;
https://github.com/rbicelli/pfsense-zabbix-template</description>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
<discovery_rules>
<discovery_rule>
<name>OpenVPN User Auth Connected Clients Discovery</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.discovery[openvpn_server_user]</key>
<delay>60s</delay>
<description>Discovery of clients connected to OpenVPN Server in User Auth Mode</description>
<item_prototypes>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Bytes Received</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},bytes_recv]</key>
<delay>60s</delay>
<trends>0</trends>
<units>bytes</units>
<description>Client Bytes Received</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Bytes Sent</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},bytes_sent]</key>
<delay>60s</delay>
<trends>0</trends>
<units>bytes</units>
<description>Client Bytes Sent</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Connection Time</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},connect_time_unix]</key>
<delay>60s</delay>
<trends>0</trends>
<units>unixtime</units>
<description>Client Connect Time</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Remote Host</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},remote_host]</key>
<delay>60s</delay>
<trends>0</trends>
<value_type>TEXT</value_type>
<description>Remote Host</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: User Name</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},user_name]</key>
<delay>60s</delay>
<trends>0</trends>
<value_type>TEXT</value_type>
<description>Client User Name</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Virtual IP Address (IPv6)</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},virtual_addr6]</key>
<delay>60s</delay>
<trends>0</trends>
<value_type>TEXT</value_type>
<description>IPv6 Address assigned from OpenVPN Server</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Virtual IP Address</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue,{#UNIQUEID},virtual_addr]</key>
<delay>60s</delay>
<trends>0</trends>
<value_type>TEXT</value_type>
<description>IP Address assigned from OpenVPN Server</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Client ID</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue_numeric,{#UNIQUEID},client_id]</key>
<delay>60s</delay>
<trends>0</trends>
<description>Client ID</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>OpenVPN Server {#SERVERNAME}, Client {#USERID}: Peer ID</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[openvpn_server_uservalue_numeric,{#UNIQUEID},peer_id]</key>
<delay>60s</delay>
<trends>0</trends>
<description>Peer ID</description>
<applications>
<application>
<name>OpenVPN Server Clients</name>
</application>
</applications>
</item_prototype>
</item_prototypes>
</discovery_rule>
</discovery_rules>
</template>
</templates>
</zabbix_export>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>5.0</version>
<date>2021-07-12T10:37:45Z</date>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<templates>
<template>
<template>pfSense Active Speedtest</template>
<name>pfSense Active: Speedtest</name>
<description>Extension for pfSense Active Template.&#13;
Executes Speedtests on WAN Interfaces.&#13;
&#13;
Requires pfsense_zbx.php installed to pfSense Box.&#13;
Version 1.0.5&#13;
&#13;
https://github.com/rbicelli/pfsense-zabbix-template</description>
<groups>
<group>
<name>Templates/Network Devices</name>
</group>
</groups>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
<discovery_rules>
<discovery_rule>
<name>WAN Interfaces</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.discovery[wan]</key>
<delay>6h</delay>
<description>Discover WAN Interfaces</description>
<item_prototypes>
<item_prototype>
<name>Speedtest Download on {#IFDESCR}</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[if_speedtest_value,{#IFNAME},download]</key>
<delay>30m</delay>
<value_type>FLOAT</value_type>
<units>bps</units>
<description>Download speed determined by Ookla Speedtest package</description>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>Speedtest Ping on {#IFDESCR}</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[if_speedtest_value,{#IFNAME},ping]</key>
<delay>30m</delay>
<value_type>FLOAT</value_type>
<units>ms</units>
<description>Ping determined by Ookla Speedtest package</description>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
</item_prototype>
<item_prototype>
<name>Speedtest Upload on {#IFDESCR}</name>
<type>ZABBIX_ACTIVE</type>
<key>pfsense.value[if_speedtest_value,{#IFNAME},upload]</key>
<delay>30m</delay>
<value_type>FLOAT</value_type>
<units>bps</units>
<description>Ping determined by Ookla Speedtest package</description>
<applications>
<application>
<name>Network interfaces</name>
</application>
</applications>
</item_prototype>
</item_prototypes>
<graph_prototypes>
<graph_prototype>
<name>Speedtest metrics on {#IFDESCR}</name>
<graph_items>
<graph_item>
<color>199C0D</color>
<calc_fnc>ALL</calc_fnc>
<item>
<host>pfSense Active Speedtest</host>
<key>pfsense.value[if_speedtest_value,{#IFNAME},download]</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<color>FFFF00</color>
<calc_fnc>ALL</calc_fnc>
<item>
<host>pfSense Active Speedtest</host>
<key>pfsense.value[if_speedtest_value,{#IFNAME},upload]</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<color>0040FF</color>
<calc_fnc>ALL</calc_fnc>
<item>
<host>pfSense Active Speedtest</host>
<key>pfsense.value[if_speedtest_value,{#IFNAME},ping]</key>
</item>
</graph_item>
</graph_items>
</graph_prototype>
</graph_prototypes>
</discovery_rule>
</discovery_rules>
</template>
</templates>
</zabbix_export>

1809
zabbix6/pfsense_active.yaml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,247 @@
zabbix_export:
version: '6.0'
date: '2023-02-26T13:19:29Z'
groups:
-
uuid: 4918b88734c54bd094cff7585b5d71fc
name: 'Templates/Network Devices'
templates:
-
uuid: 7b956a3e6aa1464781b38a854872a1c6
template: 'Template pfSense Active IPsec'
name: 'pfSense Active: IPsec'
description: |
Extension for pfSense Active Template.
Monitor IPsec VPN.
Requires pfsense_zbx.php installed to pfSense Box.
Version 1.0.2
https://github.com/rbicelli/pfsense-zabbix-template
groups:
-
name: 'Templates/Network Devices'
discovery_rules:
-
uuid: e7526169245d49a6aa6afbcacaa02b18
name: 'IPsec Phase 1 Discovery'
type: ZABBIX_ACTIVE
key: 'pfsense.discovery[ipsec_ph1]'
delay: 1200s
description: 'Discovery of IPsec Phase 1'
item_prototypes:
-
uuid: 04d6b1d0a32949bfa96cf503f60b6c53
name: 'IPsec Tunnel {#IKEID} {#NAME} Tunnel Enabled'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph1,{#IKEID},disabled]'
delay: 120s
description: 'IPsec Phase 1 Tunnel Mode'
valuemap:
name: 'pfSense IPsec Enabled'
tags:
-
tag: Application
value: IPsec
-
uuid: 810da7b475df4d738c702f373771092e
name: 'IPsec Tunnel {#IKEID} {#NAME} IKE Type'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph1,{#IKEID},iketype]'
delay: 600s
description: 'IPsec Phase 1 IKE Type'
valuemap:
name: 'pfSense IPsec IKE Type'
tags:
-
tag: Application
value: IPsec
-
uuid: 47b54bc4a08e464b839bcfd5106ec5a9
name: 'IPsec Tunnel {#IKEID} {#NAME} Tunnel Mode'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph1,{#IKEID},mode]'
delay: 600s
description: 'IPsec Phase 1 Tunnel Mode'
valuemap:
name: 'pfSense IPsec Tunnel Mode'
tags:
-
tag: Application
value: IPsec
-
uuid: a404f5d20988445d8777758b95b02076
name: 'IPsec Tunnel {#IKEID} {#NAME} Protocol'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph1,{#IKEID},protocol]'
delay: 600s
description: 'IPsec Phase 1 Protocol'
valuemap:
name: 'pfSense IPsec Protocol'
tags:
-
tag: Application
value: IPsec
-
uuid: ce0d2464361e41018fdd1831db1ec4b3
name: 'IPsec Tunnel {#IKEID} {#NAME} Remote Gateway'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph1,{#IKEID},remote-gateway]'
delay: 600s
trends: '0'
value_type: TEXT
description: 'IPsec Phase 1 Remote Gateway'
tags:
-
tag: Application
value: IPsec
-
uuid: 34d7e2395d8b43ec9c0267664be27881
name: 'IPsec Tunnel {#IKEID} {#NAME} Phase 1 Status'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph1,{#IKEID},status]'
delay: 60s
description: 'IPsec Phase 1 Tunnel Mode'
valuemap:
name: 'pfSense IPsec Phase 1 Status'
tags:
-
tag: Application
value: IPsec
trigger_prototypes:
-
uuid: d675635e19aa4cd7a7202e983cbe4ce6
expression: 'last(/Template pfSense Active IPsec/pfsense.value[ipsec_ph1,{#IKEID},disabled])=0 and last(/Template pfSense Active IPsec/pfsense.value[ipsec_ph1,{#IKEID},status])<>1 and last(/Template pfSense Active IPsec/pfsense.value[ipsec_ph1,{#IKEID},status])<10'
name: 'IPsec Tunnel {#IKEID} ({#NAME}) Not Connected'
priority: HIGH
description: 'IPsec Phase 1 is not connected.'
-
uuid: fa934077cae64a049e68e2130e5e1e84
name: 'IPsec Phase 2 Discovery'
type: ZABBIX_ACTIVE
key: 'pfsense.discovery[ipsec_ph2]'
delay: 1200s
description: 'Discovery of IPsec Phase 2'
item_prototypes:
-
uuid: 1857b124103c4f08b5ed962259fcbe06
name: 'IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Enabled'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph2,{#UNIQID},disabled]'
delay: 120s
description: 'IPsec Tunnel Phase 2 Protocol'
valuemap:
name: 'pfSense IPsec Enabled'
tags:
-
tag: Application
value: IPsec
-
uuid: 3ac7d6d1be034a3db8afad18791b43aa
name: 'IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Life Time'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph2,{#UNIQID},lifetime]'
delay: 600s
units: s
description: 'IPsec Tunnel Phase 2 Life Time'
tags:
-
tag: Application
value: IPsec
-
uuid: dfbae3fe2bcd45f3ac38c6ea0df5d250
name: 'IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Mode'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph2,{#UNIQID},mode]'
delay: 600s
description: 'IPsec Tunnel Phase 2 Mode'
tags:
-
tag: Application
value: IPsec
-
uuid: 794565a046ff447ca8ad3a7597ee52f5
name: 'IPsec Tunnel {#IKEID}.{#REQID} {#NAME} Phase 2 Protocol'
type: ZABBIX_ACTIVE
key: 'pfsense.value[ipsec_ph2,{#UNIQID},protocol]'
delay: 600s
description: 'IPsec Tunnel Phase 2 Protocol'
valuemap:
name: 'pfSense IPsec Phase 2 Protocol'
tags:
-
tag: Application
value: IPsec
valuemaps:
-
uuid: fb66440f3f454b36ae5c5d7b015529a1
name: 'pfSense IPsec Enabled'
mappings:
-
value: '0'
newvalue: 'Yes'
-
value: '1'
newvalue: 'No'
-
uuid: 7077365285f14733a55edd9ade5fdfcb
name: 'pfSense IPsec IKE Type'
mappings:
-
value: '0'
newvalue: Auto
-
value: '1'
newvalue: 'IKE v1'
-
value: '2'
newvalue: 'IKE v2'
-
uuid: a7a80f8152804c6f882898ca7378c403
name: 'pfSense IPsec Phase 1 Status'
mappings:
-
value: '0'
newvalue: Down
-
value: '1'
newvalue: Established
-
value: '2'
newvalue: Connecting
-
value: '10'
newvalue: 'Down on CARP Secondary'
-
uuid: 55e4705203cf4b5996dcd6e10cd508b9
name: 'pfSense IPsec Phase 2 Protocol'
mappings:
-
value: '1'
newvalue: ESP
-
value: '2'
newvalue: AH
-
uuid: b72cdb06faec4f9492913ba820677370
name: 'pfSense IPsec Protocol'
mappings:
-
value: '0'
newvalue: 'Dual Stack (IPv4 & IPv6)'
-
value: '1'
newvalue: IPv4
-
value: '2'
newvalue: IPv6
-
uuid: 864f6d2be4c544cf8fe38b9a619363b5
name: 'pfSense IPsec Tunnel Mode'
mappings:
-
value: '0'
newvalue: Main
-
value: '1'
newvalue: Aggressive

View File

@ -0,0 +1,147 @@
zabbix_export:
version: '6.0'
date: '2023-02-26T13:19:53Z'
groups:
-
uuid: 4918b88734c54bd094cff7585b5d71fc
name: 'Templates/Network Devices'
templates:
-
uuid: 6a1ef5e767cc4aba85c0d1712972eeb2
template: 'Template pfSense Active OpenVPN Server User Auth'
name: 'pfSense Active: OpenVPN Server User Auth'
description: |
Extension for pfSense Active Template.
Monitor client Connections of OpenVPN Server.
Requires pfsense_zbx.php installed to pfSense Box.
Version 1.0.2
https://github.com/rbicelli/pfsense-zabbix-template
groups:
-
name: 'Templates/Network Devices'
discovery_rules:
-
uuid: bae30f6a683e407aa9eeafbf9edb9179
name: 'OpenVPN User Auth Connected Clients Discovery'
type: ZABBIX_ACTIVE
key: 'pfsense.discovery[openvpn_server_user]'
delay: 60s
description: 'Discovery of clients connected to OpenVPN Server in User Auth Mode'
item_prototypes:
-
uuid: 272166157ee4456b887e7df305167c2d
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Bytes Received'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},bytes_recv]'
delay: 60s
trends: '0'
units: bytes
description: 'Client Bytes Received'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 1acfb6c10d4d4a8d97281f37e757d3bf
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Bytes Sent'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},bytes_sent]'
delay: 60s
trends: '0'
units: bytes
description: 'Client Bytes Sent'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 5f779a0e03b84be19030766d6fcffd92
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Connection Time'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},connect_time_unix]'
delay: 60s
trends: '0'
units: unixtime
description: 'Client Connect Time'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 40b0a64862a44a99a33581b916ad6467
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Remote Host'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},remote_host]'
delay: 60s
trends: '0'
value_type: TEXT
description: 'Remote Host'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 8e1b6f2d8397483d8a2768babd93a1a7
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: User Name'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},user_name]'
delay: 60s
trends: '0'
value_type: TEXT
description: 'Client User Name'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 0329f5bf3fb94bdaa30c0e412bc337f8
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Virtual IP Address (IPv6)'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},virtual_addr6]'
delay: 60s
trends: '0'
value_type: TEXT
description: 'IPv6 Address assigned from OpenVPN Server'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 1c21ccdd3bf14aa3b8b65986b5317f6a
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Virtual IP Address'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue,{#UNIQUEID},virtual_addr]'
delay: 60s
trends: '0'
value_type: TEXT
description: 'IP Address assigned from OpenVPN Server'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: 15192106b2164e0e9df447ba330007db
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Client ID'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue_numeric,{#UNIQUEID},client_id]'
delay: 60s
trends: '0'
description: 'Client ID'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'
-
uuid: de719e75d02440fe96c987bd5ddcb367
name: 'OpenVPN Server {#SERVERNAME}, Client {#USERID}: Peer ID'
type: ZABBIX_ACTIVE
key: 'pfsense.value[openvpn_server_uservalue_numeric,{#UNIQUEID},peer_id]'
delay: 60s
trends: '0'
description: 'Peer ID'
tags:
-
tag: Application
value: 'OpenVPN Server Clients'

View File

@ -0,0 +1,97 @@
zabbix_export:
version: '6.0'
date: '2023-02-26T13:20:29Z'
groups:
-
uuid: 4918b88734c54bd094cff7585b5d71fc
name: 'Templates/Network Devices'
templates:
-
uuid: 1c7cba22540d4c10a5ee14c2b25223ca
template: 'pfSense Active Speedtest'
name: 'pfSense Active: Speedtest'
description: |
Extension for pfSense Active Template.
Executes Speedtests on WAN Interfaces.
Requires pfsense_zbx.php installed to pfSense Box.
Version 1.0.5
https://github.com/rbicelli/pfsense-zabbix-template
groups:
-
name: 'Templates/Network Devices'
discovery_rules:
-
uuid: 40288914aa9742adb93120c367263690
name: 'WAN Interfaces'
type: ZABBIX_ACTIVE
key: 'pfsense.discovery[wan]'
delay: 300s
description: 'Discover WAN Interfaces'
item_prototypes:
-
uuid: a79d28cf3f3b4981b59f571117e64d24
name: 'Speedtest Download on {#IFDESCR}'
type: ZABBIX_ACTIVE
key: 'pfsense.value[if_speedtest_value,{#IFNAME},download]'
delay: 3600s
value_type: FLOAT
units: bps
description: 'Download speed determined by Ookla Speedtest package'
tags:
-
tag: Application
value: 'Network interfaces'
-
uuid: 52b640fcdf484b538f85bf32d2afbcf3
name: 'Speedtest Ping on {#IFDESCR}'
type: ZABBIX_ACTIVE
key: 'pfsense.value[if_speedtest_value,{#IFNAME},ping]'
delay: 3600s
value_type: FLOAT
units: ms
description: 'Ping determined by Ookla Speedtest package'
tags:
-
tag: Application
value: 'Network interfaces'
-
uuid: 4bd063f24e554832b59bfa2231d53bf1
name: 'Speedtest Upload on {#IFDESCR}'
type: ZABBIX_ACTIVE
key: 'pfsense.value[if_speedtest_value,{#IFNAME},upload]'
delay: 3600s
value_type: FLOAT
units: bps
description: 'Ping determined by Ookla Speedtest package'
tags:
-
tag: Application
value: 'Network interfaces'
graph_prototypes:
-
uuid: 74cdea0b8136495496bb90593bd78a59
name: 'Speedtest metrics on {#IFDESCR}'
graph_items:
-
sortorder: '1'
color: 199C0D
calc_fnc: ALL
item:
host: 'pfSense Active Speedtest'
key: 'pfsense.value[if_speedtest_value,{#IFNAME},download]'
-
sortorder: '2'
color: FFFF00
calc_fnc: ALL
item:
host: 'pfSense Active Speedtest'
key: 'pfsense.value[if_speedtest_value,{#IFNAME},upload]'
-
sortorder: '3'
color: 0040FF
calc_fnc: ALL
item:
host: 'pfSense Active Speedtest'
key: 'pfsense.value[if_speedtest_value,{#IFNAME},ping]'