Skip to content

Instantly share code, notes, and snippets.

@Aricg
Last active August 29, 2015 14:02
Show Gist options
  • Select an option

  • Save Aricg/b270892655992f688ca3 to your computer and use it in GitHub Desktop.

Select an option

Save Aricg/b270892655992f688ca3 to your computer and use it in GitHub Desktop.
add graphs for host, cacti
#!/bin/bash
usage () {
cat << EOF
Description: Add Graphs for $hostid
Graphs added:
53 Host MIB - Uptime
4 ucd/net - CPU Usage
38 ucd/net - Interrupts/Context Switches
11 ucd/net - Load Average
13 ucd/net - Memory Usage
37 ucd/net - Swap Usage
Usage: "$0" x
EOF
exit 1
}
if [[ -z "$1" ]]; then usage
fi
for x in 53 4 38 11 13 37; do
sudo php /var/lib/cacti/cli/add_graphs.php \
--host-id="$1" \
--graph-type=cg \
--graph-template-id=$x
done
##Adding Graphs for Diskspace
#!/bin/bash
for i in $(seq 73 95); do
sudo php /var/lib/cacti/cli/add_graphs.php \
--host-id="$i" \
--graph-type=ds \
--snmp-query-id=8 \
--snmp-query-type-id=18 \
--graph-template-id=26 \
--snmp-field=hrStorageDescr \
--snmp-value="/"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment