Skip to content

Commit 7651520

Browse files
committed
update temp to exclude anything over 20mins
1 parent ca968cc commit 7651520

14 files changed

+413
-149
lines changed

diskfree.sh

+21
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,23 @@
11
#!/bin/sh
2+
# +-------------------------------------------------------------------------+
3+
# | Copyright (C) 2004-2022 The Cacti Group |
4+
# | |
5+
# | This program is free software; you can redistribute it and/or |
6+
# | modify it under the terms of the GNU General Public License |
7+
# | as published by the Free Software Foundation; either version 2 |
8+
# | of the License, or (at your option) any later version. |
9+
# | |
10+
# | This program is distributed in the hope that it will be useful, |
11+
# | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12+
# | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13+
# | GNU General Public License for more details. |
14+
# +-------------------------------------------------------------------------+
15+
# | Cacti: The Complete RRDTool-based Graphing Solution |
16+
# +-------------------------------------------------------------------------+
17+
# | This code is designed, written, and maintained by the Cacti Group. See |
18+
# | about.php and/or the AUTHORS file for specific developer information. |
19+
# +-------------------------------------------------------------------------+
20+
# | http://www.cacti.net/ |
21+
# +-------------------------------------------------------------------------+
22+
223
df -k $1 | grep -v Filesystem| awk '{printf "megabytes:" $4 " percent:" int($5)}'

index.php

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
11
<?php
2+
/*
3+
+-------------------------------------------------------------------------+
4+
| Copyright (C) 2004-2022 The Cacti Group |
5+
| |
6+
| This program is free software; you can redistribute it and/or |
7+
| modify it under the terms of the GNU General Public License |
8+
| as published by the Free Software Foundation; either version 2 |
9+
| of the License, or (at your option) any later version. |
10+
| |
11+
| This program is distributed in the hope that it will be useful, |
12+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
13+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14+
| GNU General Public License for more details. |
15+
+-------------------------------------------------------------------------+
16+
| Cacti: The Complete RRDTool-based Graphing Solution |
17+
+-------------------------------------------------------------------------+
18+
| This code is designed, written, and maintained by the Cacti Group. See |
19+
| about.php and/or the AUTHORS file for specific developer information. |
20+
+-------------------------------------------------------------------------+
21+
| http://www.cacti.net/ |
22+
+-------------------------------------------------------------------------+
23+
*/
224

325
header('Location:../index.php');

query_host_cpu.php

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
<?php
2+
/*
3+
+-------------------------------------------------------------------------+
4+
| Copyright (C) 2004-2022 The Cacti Group |
5+
| |
6+
| This program is free software; you can redistribute it and/or |
7+
| modify it under the terms of the GNU General Public License |
8+
| as published by the Free Software Foundation; either version 2 |
9+
| of the License, or (at your option) any later version. |
10+
| |
11+
| This program is distributed in the hope that it will be useful, |
12+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
13+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14+
| GNU General Public License for more details. |
15+
+-------------------------------------------------------------------------+
16+
| Cacti: The Complete RRDTool-based Graphing Solution |
17+
+-------------------------------------------------------------------------+
18+
| This code is designed, written, and maintained by the Cacti Group. See |
19+
| about.php and/or the AUTHORS file for specific developer information. |
20+
+-------------------------------------------------------------------------+
21+
| http://www.cacti.net/ |
22+
+-------------------------------------------------------------------------+
23+
*/
224

3-
$no_http_headers = true;
4-
5-
/* do NOT run this script through a web browser */
625
error_reporting(0);
726

827
include(dirname(__FILE__) . '/../include/cli_check.php');

query_host_partitions.php

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,27 @@
11
<?php
2+
/*
3+
+-------------------------------------------------------------------------+
4+
| Copyright (C) 2004-2022 The Cacti Group |
5+
| |
6+
| This program is free software; you can redistribute it and/or |
7+
| modify it under the terms of the GNU General Public License |
8+
| as published by the Free Software Foundation; either version 2 |
9+
| of the License, or (at your option) any later version. |
10+
| |
11+
| This program is distributed in the hope that it will be useful, |
12+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
13+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14+
| GNU General Public License for more details. |
15+
+-------------------------------------------------------------------------+
16+
| Cacti: The Complete RRDTool-based Graphing Solution |
17+
+-------------------------------------------------------------------------+
18+
| This code is designed, written, and maintained by the Cacti Group. See |
19+
| about.php and/or the AUTHORS file for specific developer information. |
20+
+-------------------------------------------------------------------------+
21+
| http://www.cacti.net/ |
22+
+-------------------------------------------------------------------------+
23+
*/
224

3-
$no_http_headers = true;
4-
5-
/* do NOT run this script through a web browser */
625
error_reporting(0);
726

827
include(dirname(__FILE__) . '/../include/cli_check.php');

sql.php

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
<?
2-
3-
/* do NOT run this script through a web browser */
4-
$no_http_headers = true;
1+
<?php
52

63
error_reporting(0);
74

ss_count_oids.php

+29-8
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,42 @@
1+
#!/usr/bin/env php
12
<?php
3+
/*
4+
+-------------------------------------------------------------------------+
5+
| Copyright (C) 2004-2022 The Cacti Group |
6+
| |
7+
| This program is free software; you can redistribute it and/or |
8+
| modify it under the terms of the GNU General Public License |
9+
| as published by the Free Software Foundation; either version 2 |
10+
| of the License, or (at your option) any later version. |
11+
| |
12+
| This program is distributed in the hope that it will be useful, |
13+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
14+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15+
| GNU General Public License for more details. |
16+
+-------------------------------------------------------------------------+
17+
| Cacti: The Complete RRDtool-based Graphing Solution |
18+
+-------------------------------------------------------------------------+
19+
| This code is designed, written, and maintained by the Cacti Group. See |
20+
| about.php and/or the AUTHORS file for specific developer information. |
21+
+-------------------------------------------------------------------------+
22+
| http://www.cacti.net/ |
23+
+-------------------------------------------------------------------------+
24+
*/
225

3-
$no_http_headers = true;
4-
5-
/* display no errors */
626
error_reporting(0);
727

828
if (!isset($called_by_script_server)) {
9-
include(dirname(__FILE__) . '/../include/global.php');
29+
include(dirname(__FILE__) . '/../include/cli_check.php');
30+
include_once(dirname(__FILE__) . '/../lib/snmp.php');
31+
1032
array_shift($_SERVER['argv']);
33+
1134
print call_user_func_array('ss_count_oids', $_SERVER['argv']);
35+
} else {
36+
include_once(dirname(__FILE__) . '/../lib/snmp.php');
1237
}
1338

1439
function ss_count_oids($hostid = '', $oid = '') {
15-
global $config;
16-
17-
include_once($config['base_path'] . '/lib/snmp.php');
18-
1940
if ($hostid > 0) {
2041
$host = db_fetch_row_prepared('SELECT hostname, snmp_community, snmp_version, snmp_username, snmp_password,
2142
snmp_auth_protocol, snmp_priv_passphrase, snmp_priv_protocol, snmp_context,

ss_fping.php

+64-33
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,90 @@
1+
#!/usr/bin/env php
12
<?php
2-
#!/usr/bin/php -q
3+
/*
4+
+-------------------------------------------------------------------------+
5+
| Copyright (C) 2004-2022 The Cacti Group |
6+
| |
7+
| This program is free software; you can redistribute it and/or |
8+
| modify it under the terms of the GNU General Public License |
9+
| as published by the Free Software Foundation; either version 2 |
10+
| of the License, or (at your option) any later version. |
11+
| |
12+
| This program is distributed in the hope that it will be useful, |
13+
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
14+
| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15+
| GNU General Public License for more details. |
16+
+-------------------------------------------------------------------------+
17+
| Cacti: The Complete RRDtool-based Graphing Solution |
18+
+-------------------------------------------------------------------------+
19+
| This code is designed, written, and maintained by the Cacti Group. See |
20+
| about.php and/or the AUTHORS file for specific developer information. |
21+
+-------------------------------------------------------------------------+
22+
| http://www.cacti.net/ |
23+
+-------------------------------------------------------------------------+
24+
*/
325

4-
/* do NOT run this script through a web browser */
5-
$no_http_headers = true;
6-
7-
/* display no errors */
826
error_reporting(0);
927

10-
include_once(dirname(__FILE__) . '/../include/cli_check.php');
11-
include_once(dirname(__FILE__) . '/../lib/snmp.php');
12-
include_once(dirname(__FILE__) . '/../lib/ping.php');
13-
1428
if (!isset($called_by_script_server)) {
29+
include_once(dirname(__FILE__) . '/../include/cli_check.php');
30+
include_once(dirname(__FILE__) . '/../lib/snmp.php');
31+
include_once(dirname(__FILE__) . '/../lib/ping.php');
32+
1533
array_shift($_SERVER['argv']);
34+
1635
print call_user_func_array('ss_fping', $_SERVER['argv']);
36+
} else {
37+
include_once(dirname(__FILE__) . '/../lib/snmp.php');
38+
include_once(dirname(__FILE__) . '/../lib/ping.php');
1739
}
18-
//End header.
1940

20-
function ss_fping($hostname, $ping_sweeps=6, $ping_type='ICMP', $port=80) {
41+
function ss_fping($hostname = '', $ping_sweeps = 6, $ping_type = 'ICMP', $port = 80) {
2142
/* record start time */
22-
list($micro,$seconds) = explode(' ', microtime());
23-
$ss_fping_start = $seconds + $micro;
43+
$ss_fping_start = microtime(true);
2444

2545
$ping = new Net_Ping;
2646

27-
$time = array();
28-
$total_time = 0;
47+
$time = array();
48+
$total_time = 0;
2949
$failed_results = 0;
3050

3151
$ping->host['hostname'] = gethostbyname($hostname);
32-
$ping->retries = 1;
33-
$ping->port = $port;
52+
$ping->retries = 1;
53+
$ping->port = $port;
54+
3455
$max = 0.0;
3556
$min = 9999.99;
3657
$dev = 0.0;
3758

3859
$script_timeout = read_config_option('script_timeout');
39-
$ping_timeout = read_config_option('ping_timeout');
40-
41-
switch ($ping_type) {
42-
case 'ICMP':
43-
$method = PING_ICMP;
44-
break;
45-
case 'TCP':
46-
$method = PING_TCP;
47-
break;
48-
case 'UDP':
49-
$method = PING_UDP;
50-
break;
60+
61+
$ping_timeout = db_fetch_cell_prepared('SELECT ping_timeout
62+
FROM host
63+
WHERE hostname = ?',
64+
array($hostname));
65+
66+
if (empty($ping_timeout)) {
67+
$ping_timeout = read_config_option('ping_timeout');
68+
}
69+
70+
switch (strtoupper($ping_type)) {
71+
case 'ICMP':
72+
$method = PING_ICMP;
73+
74+
break;
75+
case 'TCP':
76+
$method = PING_TCP;
77+
78+
break;
79+
case 'UDP':
80+
$method = PING_UDP;
81+
82+
break;
5183
}
5284

5385
$i = 0;
5486
while ($i < $ping_sweeps) {
55-
$result = $ping->ping(AVAIL_PING, $method, read_config_option('ping_timeout'), 1);
87+
$result = $ping->ping(AVAIL_PING, $method, $ping_timeout, 1);
5688

5789
if (!$result) {
5890
$failed_results++;
@@ -66,8 +98,7 @@ function ss_fping($hostname, $ping_sweeps=6, $ping_type='ICMP', $port=80) {
6698
$i++;
6799

68100
/* get current time */
69-
list($micro,$seconds) = explode(' ', microtime());
70-
$ss_fping_current = $seconds + $micro;
101+
$ss_fping_current = microtime(true);
71102

72103
/* if called from script server, end one second before a timeout occurs */
73104
if (isset($called_by_script_server) && ($ss_fping_current - $ss_fping_start + ($ping_timeout/1000) + 1) > $script_timeout) {
@@ -80,7 +111,7 @@ function ss_fping($hostname, $ping_sweeps=6, $ping_type='ICMP', $port=80) {
80111
return 'min:U avg:U max:U dev:U loss:100.00';
81112
} else {
82113
$loss = ($failed_results/$ping_sweeps) * 100;
83-
$avg = $total_time/($ping_sweeps-$failed_results);
114+
$avg = $total_time/($ping_sweeps-$failed_results);
84115

85116
/* calculate standard deviation */
86117
$predev = 0;

0 commit comments

Comments
 (0)