pfsense-zabbix-template
pfsense-zabbix-template copied to clipboard
Repaired get_ipsecifnum. Working with pre 2.6 and 2.6 pfsense
Hi. Just repaired main script so it supports older and newer pfsense versions. I have added zabbix6 directory with template saved from Zabbix 6.
There are new very important triggers:
Because if connection is not working, it was not visible.
Thanks to Steffen Schiffel for initial idea!
Good job, It is woking for me ( Zabbix 6.0 & pfSense 2.6)
ipsec status is not working properly for me, I have 2 tunnels but
php /root/scripts/pfsense_zbx.php ipsec_ph1 1 status php /root/scripts/pfsense_zbx.php ipsec_ph1 2 status
both are returning always 0 regardless if tunnel is connected or disconnected
get_ipsecifnum function does not exist in my system, so I modified your code by adding: $conmap[$cname] = $ph1ent['ikeid']; to function pfz_ipsec_status:
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";
}
$conmap[$cname] = $ph1ent['ikeid'];
} else{
$cname = ipsec_conid($ph1ent);
$conmap[$cname] = $ph1ent['ikeid'];
}
}
....
Hi, I added $conmap[$cname] = $ph1ent['ikeid']; like you wrote, now it's work as well about ipsec phase1 status but doesn't work to about ipsec phase 2 status. Do you have any idea? Thanks