Monitorizar pfSense com o DumbMonit
A pfSense firewall through its REST API package: gateways down or losing packets, interfaces without link, stopped services, CPU, memory and disk.
DocumentaçãoSite oficial: pfSense
As descrições estão em inglês, como no produto. Os rótulos da página seguem o seu idioma.
O que o DumbMonit vigia
A pfSense firewall through the community REST API package (pfSense-pkg-RESTAPI, version 2): gateways that are down, lose packets or answer slowly, enabled interfaces without link, enabled services that stopped, and CPU, memory, disk and temperature. DumbMonit sends an API key in the X-API-Key header. A key carries exactly the privileges of the pfSense user it belongs to: the dumbmonit user below holds only the GET privileges of the five pages DumbMonit reads, so the key can read those pages and change nothing. Every minute DumbMonit reads, in parallel, /api/v2/status/system, /api/v2/status/gateways, /api/v2/status/interfaces, /api/v2/status/services and /api/v2/system/version, and, if the…
Utilização típica. Firewall: gateways down or lossy, interfaces without link, stopped services
Exemplos
- pfSense CE
- pfSense Plus
- Netgate appliance
Como se liga
O que precisa
- REST API keyThe key created for the dumbmonit user: it carries only that user's read privileges.
Portas de rede a abrir
443/TCPAPI (HTTPS, default)80/TCPOnly with the HTTP protocol option
Passos de configuração: Create a read-only REST API key for DumbMonit
Install the pfSense-pkg-RESTAPI package (version 2) from Diagnostics → Command Prompt, with the file matching your pfSense version (2.7.2 below).
pkg-static add https://github.com/pfrest/pfSense-pkg-RESTAPI/releases/latest/download/pfSense-2.7.2-pkg-RESTAPI.pkgSystem → REST API → Settings: tick both BasicAuth and Key among the authentication methods.
System → User Manager → Users → Add: create the user dumbmonit with a long random password.
Edit the user and, under Assigned Privileges, add the privileges listed below.
Create the key as dumbmonit, copy the key value of the answer, then remove the POST privilege again.
curl -k -u dumbmonit -X POST -H 'Content-Type: application/json' -d '{"descr":"DumbMonit"}' https://pfsense.lan/api/v2/auth/keyIn DumbMonit, enter the pfSense address (pfsense.lan) and paste the key as API key.
Atenção. The REST API package is a community project, not part of pfSense: reinstall it after each pfSense upgrade. pfSense ships a self-signed certificate: tick "Accept an unverifiable certificate" unless you replaced it.