no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | tech:linux:pnp4nagios_graphs [2017/01/04 12:25] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== pnp4nagios extracting graphs ====== | ||
+ | Bash script to extract graphs for previous month | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | # | ||
+ | WDIR=/ | ||
+ | OUTDIR=$WDIR/ | ||
+ | mkdir -p $OUTDIR | ||
+ | INPFILE=$WDIR/ | ||
+ | GRZIP=$WDIR/ | ||
+ | # | ||
+ | # 1st day of last month | ||
+ | stime=$(date -d "`date +%Y%m01` -1 month" +%s) | ||
+ | # 1st day of this month | ||
+ | etime=$(date -d "`date +%Y%m01`" | ||
+ | # | ||
+ | while read HN DB; do | ||
+ | GURL=" | ||
+ | PNGF=" | ||
+ | wget -O $PNGF -q --user=nagiosadmin --password=ENTERPASSWORD " | ||
+ | done < $INPFILE | ||
+ | # | ||
+ | rm $GRZIP | ||
+ | zip -r -j -q $GRZIP $OUTDIR | ||
+ | echo "" | ||
+ | exit | ||
+ | </ | ||
+ | |||
+ | |||
+ | File: month_graphs.txt | ||
+ | < | ||
+ | server1 CPU | ||
+ | server1 Memory | ||
+ | server2 CPU | ||
+ | etc ... | ||
+ | </ | ||