Skip to content

Instantly share code, notes, and snippets.

View infotek's full-sized avatar

Jason Ellison infotek

View GitHub Profile
@infotek
infotek / ds-name cleanup
Last active October 6, 2016 22:27
librenms perf data from nagios plugin checks should not exceed 19 characters or conflict with existing ds-names
<?php
$perf = array
(
Qcache_free_memory => array
(
value => 15848240,
uom => ''
),
Qcache_inserts => array
Adding SNMP Informant Standard to librenms
http://docs.librenms.org/Extensions/MIB-based-polling/#how-to-add-a-new-device-mib
SNMP Informant Standard is a 100% free, scaled down version of SNMP Informant Advanced.
agent:
http://www.snmp-informant.com/snmp-informant-standard.htm
mibs:
root@shell:/opt/librenms# /usr/lib/nagios/plugins/check_mysql -H localhost -H localhost -d librenms -H localhost -u librenms -p password
Uptime: 637459 Threads: 7 Questions: 644510 Slow queries: 0 Opens: 168 Flush tables: 1 Open tables: 229 Queries per second avg: 1.011|Connections=25744c;;; Open_files=62;;; Open_tables=229;;; Qcache_free_memory=15893496;;; Qcache_hits=276441c;;; Qcache_inserts=112323c;;; Qcache_lowmem_prunes=0c;;; Qcache_not_cached=14095c;;; Qcache_queries_in_cache=543;;; Queries=644510c;;; Questions=644510c;;; Table_locks_waited=0c;;; Threads_connected=7;;; Threads_running=1;;; Uptime=637459c;;;
root@shell:/opt/librenms# echo $?
0
<?php
$perf = array
(
Qcache_free_memory => array
(
value => 15848240,
uom => ''
),
Qcache_inserts => array
<?php
// TEST SCRIPT much better fix
// $command = '/usr/lib/nagios/plugins/check_mysql -u user -p password ' ;
// This array is used to test for valid UOM's to be used for graphing.
// Valid values from: https://nagios-plugins.org/doc/guidelines.html#AEN200
// Note: This array must be decend from 2 char to 1 char so that the search works correctly.
$valid_uom = array ('us', 'ms', 'KB', 'MB', 'GB', 'TB', 'c', 's', '%', 'B');
<?php
//Jason Ellison <infotek@gmail.com>
//This is a test includes/services/check_mysql.inc.php
// provide some sane default
if ($service['service_param']) {
$dbname = $service['service_param'];
} else {
$dbname = "mysql";
root@chat:~# cat /etc/*release
PRETTY_NAME="Debian GNU/Linux 8 (jessie)"
NAME="Debian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=debian
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
root@chat:~# wget -O - https://files.freeswitch.org/repo/deb/debian/freeswitch_archive_g0.pub | apt-key add -
root@chat:~# aptitude install freeswitch-meta-all
The following NEW packages will be installed:
freeswitch{a} freeswitch-conf-curl{a} freeswitch-conf-insideout{a} freeswitch-conf-sbc{a} freeswitch-conf-softphone{a}
freeswitch-conf-vanilla{a} freeswitch-lang{a} freeswitch-lang-de{a} freeswitch-lang-en{a} freeswitch-lang-es{a}
freeswitch-lang-fr{a} freeswitch-lang-he{a} freeswitch-lang-pt{a} freeswitch-lang-ru{a} freeswitch-meta-all
freeswitch-meta-codecs{a} freeswitch-meta-conf{a} freeswitch-meta-lang{a} freeswitch-meta-mod-say{a}
freeswitch-mod-abstraction{a} freeswitch-mod-amr{a} freeswitch-mod-amrwb{a} freeswitch-mod-av{a} freeswitch-mod-avmd{a}
freeswitch-mod-b64{a} freeswitch-mod-blacklist{a} freeswitch-mod-bv{a} freeswitch-mod-callcenter{a}
freeswitch-mod-cdr-csv{a} freeswitch-mod-cdr-mongodb{a} freeswitch-mod-cdr-sqlite{a} freeswitch-mod-cidlookup{a}
freeswitch-mod-codec2{a} freeswitch-mod-commands{a} freeswitch-mod-conference{a} freeswitch-mod-console{a}
### Keybase proof
I hereby claim:
* I am infotek on github.
* I am infotek (https://keybase.io/infotek) on keybase.
* I have a public key ASCQSbQ43DTpkgKBa0auFOfpFElGGSc_1mfmgA_B_pDMlwo
To claim this, I am signing this object:
@infotek
infotek / gist:bbe825f15658067bb50ec4920455c833
Last active March 2, 2018 16:44
nagios plugins not graphing
./check-services.php -d
DEBUG!
SQL[SELECT * FROM `devices` AS D, `services` AS S WHERE S.device_id = D.device_id ORDER by D.device_id DESC]
<SNIP>
Nagios Service - 28
Request: /usr/lib/nagios/plugins/check_pg_localhost -H localhost ais
Perf Data - DS: datid, Value: 16384, UOM:
Perf Data - DS: datname, Value: ai, UOM: s
Perf Data - DS: numbackends, Value: 3, UOM: