Skip to content

Instantly share code, notes, and snippets.

View graffic's full-sized avatar

Javier Gonel graffic

View GitHub Profile
@graffic
graffic / gist:1283688
Created October 13, 2011 08:01
Webservices checker script for nagios
#!/usr/bin/python2.7
from random import randrange
from datetime import timedelta,datetime
def prepare_message():
message = """<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
@graffic
graffic / gist:975224
Created May 16, 2011 20:01
Corrected Zabbix proxy query.
mysql> explain select p.id,h.host,i.key_,p.clock,p.timestamp,
p.source,p.severity,p.value,p.logeventid
from hosts h inner join items i on h.hostid=i.hostid
right outer join proxy_history p on i.itemid=p.itemid
where p.id>21824754 order by p.id limit 10\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: p
type: range
@graffic
graffic / gist:975190
Created May 16, 2011 19:51
Zabbix proxy item query
mysql> explain select p.id,h.host,i.key_,p.clock,p.timestamp,
p.source,p.severity,p.value,p.logeventid
from hosts h,items i,proxy_history p where h.hostid=i.hostid
and i.itemid=p.itemid and p.id>21824754 order by p.id limit 1000\G
*************************** 1. row ***************************
id: 1
select_type: SIMPLE
table: p
type: range
possible_keys: PRIMARY,id
@graffic
graffic / NetvolutionDuplicates.sql
Created November 24, 2010 07:27
List netvolution duplicates
WITH temp_Pages (pId, pLangId,pParentId, pFriendlyUrl) AS
(
SELECT pId, pLangId,
pParentId,
CONVERT(NVARCHAR(200),
'http://' +
(SELECT e.siteName FROM cms_Sites e WHERE e.siteID=pSiteID) +
'/' +
(SELECT c.langShortName FROM cms_Languages c WHERE c.langID=pLangID) +
'/' +