Skip to content
This repository has been archived by the owner on Jul 2, 2024. It is now read-only.

Commit

Permalink
added zabbix area and zabbix housekeeper javascript page
Browse files Browse the repository at this point in the history
  • Loading branch information
tbblake committed May 16, 2023
1 parent 92d81c2 commit 03b1428
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
Empty file added .gitignore
Empty file.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ A php script and lighttpd configuration to quickly view your dhcp leases [dhcpPi
Random bash code I've used here and there [bash](bash)
## SQL
Random SQL code I've used here and there [sql](sql)
## Zabbix
Zabbix scripts [Zabbix](zabbix)
4 changes: 4 additions & 0 deletions zabbix/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Zabbix
Scripts to use with [Zabbix](https://www.zabbix.com)

houseKeeperLogParser.html -- A javascript housekeeper log parser. Paste your zabbix_server.log in here to parse out the useful stats from the housekeeper. Support for 4.0, 6.0, and 6.4.
45 changes: 45 additions & 0 deletions zabbix/houseKeeperLogParser.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<HTML>
<HEAD>
<SCRIPT>
var logRegexes = {
'4.0' : myRegex=/\s+\d+:(\d{4})(\d{2})(\d{2}):(\d{2})(\d{2})(\d{2})\.\d+ housekeeper \[deleted (\d+) hist\/trends, (\d+) items\/triggers, (\d+) events, (\d+) problems, (\d+) sessions, (\d+) alarms, (\d+) audit items in ([0-9]+([.][0-9]*)?|[.][0-9]+) sec.*/,
'6.0' : myRegex=/\s+\d+:(\d{4})(\d{2})(\d{2}):(\d{2})(\d{2})(\d{2})\.\d+ housekeeper \[deleted (\d+) hist\/trends, (\d+) items\/triggers, (\d+) events, (\d+) problems, (\d+) sessions, (\d+) alarms, (\d+) audit, (\d+) records in ([0-9]+([.][0-9]*)?|[.][0-9]+) sec.*/
}
var parsedOut = {
'4.0' : '$2\/$3\/$1\t$4:$5:$6\t$7\t$8\t$9\t$10\t$11\t$12\t$13\t$14',
'6.0' : '$2\/$3\/$1\t$4:$5:$6\t$7\t$8\t$9\t$10\t$11\t$12\t$13\t$14\t$15'
}
function resetAll() {
document.getElementById('src').value='';
document.getElementById('dst').value='';
document.getElementById('zVer').value='4.0';
}
function parser() {
document.getElementById('dst').value='';
zVer=document.getElementById('zVer').value;
var lines=document.getElementById('src').value.split('\n');
document.getElementById('dst').value='';
for (var i=0;i<lines.length;i++) {
myRegex=logRegexes[zVer];
if (lines[i].match(myRegex)) {
var newString=lines[i].replace(myRegex,parsedOut[zVer]);
document.getElementById('dst').value+=newString+'\n';
}
}
}
</SCRIPT>
<TITLE>Zabbix Housekeeper Log Parser</TITLE>
</HEAD>
<BODY>
Zabbix version: <SELECT NAME='zVer' id='zVer' onchange='parser()'>
<OPTION VALUE='4.0'>4.0</OPTION>
<OPTION VALUE='6.0'>6.0</OPTION>
<OPTION VALUE='6.0'>6.4</OPTION>
</SELECT>&nbsp;
<BUTTON onclick='resetAll()'>Reset</BUTTON><BR><BR>
<TEXTAREA id='src' rows=4 cols=120 oninput='parser()'></TEXTAREA>
<BR>
<TEXTAREA id='dst' rows=20 cols=120></TEXTAREA>
</BODY>
</HTML>

0 comments on commit 03b1428

Please sign in to comment.