diff --git a/pfsense_zbx.php b/pfsense_zbx.php index ddb0f7b..485c520 100644 --- a/pfsense_zbx.php +++ b/pfsense_zbx.php @@ -564,7 +564,6 @@ function pfz_ipsec_discovery_ph1(){ } - function pfz_ipsec_ph1($ikeid,$valuekey){ // Get Value from IPsec Phase 1 Configuration // If Getting "disabled" value only check item presence in config array @@ -665,12 +664,16 @@ function pfz_ipsec_status($ikeid,$reqid=-1,$valuekey='state'){ $a_phase1 = &$config['ipsec']['phase1']; $conmap = array(); foreach ($a_phase1 as $ph1ent) { - if (get_ipsecifnum($ph1ent['ikeid'], 0)) { - $cname = "con" . get_ipsecifnum($ph1ent['ikeid'], 0); - } else { - $cname = "con{$ph1ent['ikeid']}00000"; - } - $conmap[$cname] = $ph1ent['ikeid']; + 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); + } } $status = ipsec_list_sa(); @@ -736,6 +739,42 @@ function pfz_ipsec_status($ikeid,$reqid=-1,$valuekey='state'){ 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){ @@ -1228,6 +1267,9 @@ function pfz_discovery($section){ case "dhcpfailover": pfz_dhcpfailover_discovery(); break; + case "temperature_sensors": + pfz_temperature_sensors_discovery(); + break; } } @@ -1295,6 +1337,9 @@ switch (strtolower($argv[1])){ case "cert_date": pfz_get_cert_date($argv[2]); break; + case "temperature": + pfz_get_temperature($argv[2]); + break; default: pfz_test(); } diff --git a/zabbix6/template_pfsense_active.xml b/zabbix6/template_pfsense_active.xml new file mode 100644 index 0000000..750958a --- /dev/null +++ b/zabbix6/template_pfsense_active.xml @@ -0,0 +1,2493 @@ + + + 6.0 + 2022-04-22T10:24:33Z + + + 4918b88734c54bd094cff7585b5d71fc + Templates/Network Devices + + + + + + + + ba26b37d090c439faf2ed71f0e8b2be3 + last(/Template pfSense Active/pfsense.expected_carp_status)<>0 and last(/Template pfSense Active/pfsense.value[carp_status])<>{$EXPECTED_CARP_STATUS} + CARP Status not Expected on {HOST.NAME} + HIGH + pfSense CARP is not in the state Expected. This means that a failover could be in process. + + + 23b24281dd5d47c58be38ecb2333b8de + (last(/Template pfSense Active/pfsense.value[system,version])<>last(/Template pfSense Active/pfsense.value[system,installed_version]))=1 + New Version Available on {HOST.NAME} + INFO + Notify of new version of pfsense available + + + + + 499d867c58974a8e914b0423bdbf3d01 + Active Connections + NO + FIXED + ITEM + + Template pfSense Active + pfsense.states.max + + + + GRADIENT_LINE + FF2C27 + + Template pfSense Active + pfsense.states.current + + + + + + 6cd23b5084844a2481beb5c34f1e603a + Active Connections (pie) + 600 + 340 + 0 + NO + NO + PIE + + + 5B5B5B + GRAPH_SUM + + Template pfSense Active + pfsense.states.max + + + + 1 + GRADIENT_LINE + FF2C27 + + Template pfSense Active + pfsense.states.current + + + + + + 15db8adacf6e4b35ba5a6b36b2ddef1f + CPU jumps + + + GRADIENT_LINE + 009900 + + Template pfSense Active + system.cpu.switches + + + + 1 + GRADIENT_LINE + 000099 + + Template pfSense Active + system.cpu.intr + + + + + + c515614caf3445e6b28858907b1d1713 + CPU load + STACKED + FIXED + + + FFA619 + + Template pfSense Active + system.cpu.load[percpu,avg1] + + + + 1 + E86E30 + + Template pfSense Active + system.cpu.load[percpu,avg5] + + + + 2 + FF2F26 + + Template pfSense Active + system.cpu.load[percpu,avg15] + + + + + + aa694daef9004553952ec7cf3fa153b1 + CPU utilization (Line) + NO + FIXED + FIXED + + + GRADIENT_LINE + FFE819 + + Template pfSense Active + system.cpu.util[,interrupt] + + + + 1 + GRADIENT_LINE + E85D17 + + Template pfSense Active + system.cpu.util[,nice] + + + + 2 + GRADIENT_LINE + DF26FF + + Template pfSense Active + system.cpu.util[,system] + + + + 3 + GRADIENT_LINE + 1775E8 + + Template pfSense Active + system.cpu.util[,user] + + + + 4 + 03D933 + + Template pfSense Active + system.cpu.util[,idle] + + + + + + 61378e27951a4882b1f88d041922ad16 + Memory Available details (pie) + 600 + 340 + 0 + NO + NO + PIE + + + 003300 + GRAPH_SUM + + Template pfSense Active + vm.memory.size[available] + + + + 1 + 005500 + + Template pfSense Active + vm.memory.size[free] + + + + 2 + 007700 + + Template pfSense Active + vm.memory.size[cached] + + + + 3 + 009900 + + Template pfSense Active + vm.memory.size[inactive] + + + + + + 625d8fc33a5d410ab2229dd2e8e99762 + Memory usage + NO + STACKED + FIXED + ITEM + + Template pfSense Active + vm.memory.size[total] + + + + 00EE00 + + Template pfSense Active + vm.memory.size[wired] + + + + 1 + 00CC00 + + Template pfSense Active + vm.memory.size[active] + + + + 2 + 007700 + + Template pfSense Active + vm.memory.size[inactive] + + + + 3 + 005500 + + Template pfSense Active + vm.memory.size[cached] + + + + 4 + 003300 + + Template pfSense Active + vm.memory.size[free] + + + + + + eeb86545b71145949b241b7d89b3a79b + Memory Usage simple (pie) + 600 + 340 + 0 + NO + NO + PIE + + + 003300 + + Template pfSense Active + vm.memory.size[available] + + + + 1 + 00DD00 + + Template pfSense Active + kt.mem.used + + + + + + ab954e447cb14b10bb902e7c43a6d31a + Network Memory Buffer + NO + STACKED + FIXED + ITEM + + Template pfSense Active + pfsense.mbuf.max + + + + B26E16 + + Template pfSense Active + pfsense.mbuf.current + + + + 1 + FFCE8E + + Template pfSense Active + pfsense.mbuf.cache + + + + + + eab355b1ef2f450a938441c913b7631a + Network Memory Buffer (pie) + 600 + 340 + 0 + NO + NO + PIE + + + 5B5B5B + GRAPH_SUM + + Template pfSense Active + pfsense.mbuf.max + + + + 1 + FFCE8E + + Template pfSense Active + pfsense.mbuf.cache + + + + 2 + B26E16 + + Template pfSense Active + pfsense.mbuf.current + + + + + + 9522838e31244b6e88a9a020bdd07602 + Swap usage + 600 + 340 + 0 + NO + NO + PIE + YES + + + 5B5B5B + GRAPH_SUM + + Template pfSense Active + system.swap.size[,total] + + + + 1 + FFFF33 + + Template pfSense Active + system.swap.size[,used] + + + + + +