Skip to content

Instantly share code, notes, and snippets.

View BlueSkyDetector's full-sized avatar

Takanori Suzuki BlueSkyDetector

View GitHub Profile
@BlueSkyDetector
BlueSkyDetector / ZBX-7091_fix_profile_for_1.8.x.patch
Created October 17, 2013 03:30
ZBX-7091_fix_profile_for_1.8.x.patch
Index: frontends/php/include/profiles.inc.php
===================================================================
--- frontends/php/include/profiles.inc.php (revision 39357)
+++ frontends/php/include/profiles.inc.php (working copy)
@@ -133,7 +133,7 @@
'profileid' => get_dbid('profiles', 'profileid'),
'userid' => $USER_DETAILS['userid'],
'idx' => zbx_dbstr($idx),
- $value_type => ($value_type == 'value_str') ? zbx_dbstr($value) : $value,
+ $value_type => zbx_dbstr($value),
@BlueSkyDetector
BlueSkyDetector / host_lists.php
Last active December 13, 2015 17:58
zabbix host list view
<?php
/*
** Zabbix
** Copyright (C) 2001-2011 Zabbix SIA
**
** This program is free software; you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation; either version 2 of the License, or
** (at your option) any later version.
**
#!/usr/bin/env python
### setting start ###
import urllib2, cookielib
login_url = 'http://192.168.0.16/zabbix/index.php'
graph_url = 'http://192.168.0.16/zabbix/chart2.php'
name = 'Admin'
password = 'zabbix'
graphid = 388
output_file = 'out_graph.jpg'
@BlueSkyDetector
BlueSkyDetector / ZBX-5348_for_1.8.x.patch
Created July 26, 2012 12:04
ZBX-5348_for_1.8.x.patch
--- popup_bitem.php.orig 2012-07-26 21:14:00.000000000 +0900
+++ popup_bitem.php 2012-07-26 21:16:40.000000000 +0900
@@ -60,7 +60,7 @@
$_REQUEST['caption'] = get_request('caption','');
$_REQUEST['axisside'] = get_request('axisside', GRAPH_YAXIS_SIDE_LEFT);
- if(zbx_empty($_REQUEST['caption']) && isset($_REQUEST['itemid']) && ($_REQUEST['itemid'] > 0)){
+ if(zbx_empty($_REQUEST['caption']) && isset($_REQUEST['itemid']) && $_REQUEST['itemid'] && zbx_is_int($_REQUEST['itemid'])){
$_REQUEST['caption'] = item_description(get_item_by_itemid($_REQUEST['itemid']));
}
@BlueSkyDetector
BlueSkyDetector / kill_process_with_mysqldb_query.py
Created June 9, 2012 19:10
kill process with mysqldb query
#!/usr/bin/python
# coding: UTF-8
import MySQLdb
import signal, os, sys
workers = {}
END_SIGNAL = "\n"
def connect():
@BlueSkyDetector
BlueSkyDetector / cint_sample.txt
Created April 6, 2012 16:57
cint interactive shell
$ root
*******************************************
* *
* W E L C O M E to R O O T *
* *
* Version 5.32/01 29 February 2012 *
* *
* You are welcome to visit our Web site *
* http://root.cern.ch *
* *
@BlueSkyDetector
BlueSkyDetector / .pythonrc.py
Created April 6, 2012 14:58
completer setting for python interactive shell
# add following line to .bashrc
#PYTHONSTARTUP=$HOME/.pythonrc.py
#export PYTHONSTARTUP
try:
import readline
import rlcompleter
pass
except ImportError, error_string:
print 'ImportError: %s' % error_string
pass
@BlueSkyDetector
BlueSkyDetector / generate_map_xml_from_csv.py
Created December 1, 2011 23:06
generate Zabbix map xml from csv
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import csv
header="""<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export version="1.0" date="11.12.01" time="16.48">
<images>
<image>
<name>Network</name>
@BlueSkyDetector
BlueSkyDetector / files_count.js
Created November 21, 2011 16:34
files count by js
function getDirectoryFilesCount(path) {
var fd = new ActiveXObject("Scripting.FileSystemObject");
var d;
var ret;
try {
d = fd.GetFolder(path);
ret = d.Files.Count;
} catch(e) {
ret = "-1";