Created
December 19, 2015 00:21
-
-
Save uberswe/107ac16632a6eb256b5f to your computer and use it in GitHub Desktop.
PFSense simple json API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: Markus Tenghamn | |
* Date: 18/12/15 | |
* Time: 11:56 | |
* | |
* Place this in /usr/local/www/ and access it to get basic data about your pfsense installation. Use at your own risk. | |
* | |
*/ | |
header('Content-Type: application/json'); | |
require_once('util.inc'); | |
require_once('filter.inc'); | |
require_once('interfaces.inc'); | |
require_once('config.inc'); | |
include_once("includes/functions.inc.php"); | |
$stats['cpu'] = strip_tags(cpu_usage()); | |
$stats['mem'] = strip_tags(mem_usage()); | |
$stats['uptime'] = strip_tags(get_uptime()); | |
$stats['states'] = strip_tags(get_pfstate()); | |
$stats['temp'] = strip_tags(get_temp()); | |
$stats['datetime'] = strip_tags(update_date_time()); | |
$stats['gateways'] = strip_tags(get_gatewaystats()); | |
$stats['cpufreq'] = strip_tags(get_cpufreq()); | |
$stats['load_average'] = strip_tags(get_load_average()); | |
$stats['mbuf'] = strip_tags(get_mbuf()); | |
$stats['mbufpercent'] = strip_tags(get_mbuf(true)); | |
$stats['statepercent'] = strip_tags(get_pfstate(true)); | |
echo json_encode($stats); | |
write_config(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment