init
This commit is contained in:
188
rancid/dev_port_overview/create_vwd_output.sh
Executable file
188
rancid/dev_port_overview/create_vwd_output.sh
Executable file
@@ -0,0 +1,188 @@
|
||||
#!/bin/bash
|
||||
|
||||
CUST1_N="VWD"
|
||||
OUTPUT="result_cust_$CUST1_N.html"
|
||||
SELECT="select_cust_$CUST1_N.sql"
|
||||
HOST="127.0.0.1"
|
||||
FIND="%-vwd-%"
|
||||
|
||||
cd /scripts/rancid/dev_port_overview/ || exit
|
||||
|
||||
echo 'select count(*) as "Network devices (SW/RTR/DWDM)" from devices where type="network" and hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
|
||||
echo "<html>
|
||||
<head>
|
||||
</head>
|
||||
<body>
|
||||
<h1>$CUST1_N Device and Port Report</h1>
|
||||
|
||||
<h2>Devices</h2>
|
||||
|
||||
<table border='1'>
|
||||
<tr>
|
||||
<td>Switches, Router, DWDM</td>
|
||||
<td>Firewalls (inclusive Cluster)</td>
|
||||
<td>Firewall Cluster</td>
|
||||
<td>Wireless</td>
|
||||
<td>Fibre Channel</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>$CUST1_R</td>" > $OUTPUT
|
||||
|
||||
echo 'select count(*) as "Firewalls (inc Cluster)" from devices where type="firewall" and hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(distinct hostname) as "Firewall Cluster" from devices t1 inner join status t2 on t1.device_id = t2.device_id where t1.type="firewall" and t2.status_descr like "Failover%" and t1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "Wireless devices" from devices where type="wireless" and hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(distinct p1.device_id) as "FC Devices" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="fibreChannel" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo " </tr>
|
||||
</table>
|
||||
|
||||
<h2>Ports</h2>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "All Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
|
||||
echo "
|
||||
<table border='1'>
|
||||
<tr>
|
||||
<td>all</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>$CUST1_R</td>
|
||||
</tr>
|
||||
</table>" >> $OUTPUT
|
||||
|
||||
echo "
|
||||
<h3>Fiber Channel</h3>
|
||||
|
||||
<table border='1'>
|
||||
<tr>
|
||||
<td>active</td>
|
||||
<td>non-active</td>
|
||||
<td>active 4G</td>
|
||||
<td>non-active 4G</td>
|
||||
<td>active 8G</td>
|
||||
<td>non-active 8G</td>
|
||||
<td>active 16G</td>
|
||||
<td>non-active 16G</td>
|
||||
</tr>
|
||||
<tr>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active FC Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active FC Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active 4G FC Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.ifspeed="4000000000" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active 4G FC Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.ifspeed="4000000000" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active 8G FC Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.ifspeed="8000000000" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active 8G FC Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.ifspeed="8000000000" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active 16G FC Ports"from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.ifspeed="16000000000" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active 16G FC Ports"from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="fibreChannel" and p1.port_label_base="fc" and p1.ifspeed="16000000000" and p1.deleted="0" and (d1.hostname like "%-vwd-%" or p1.ifalias like "tso%");' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo " </tr>
|
||||
</table>" >> $OUTPUT
|
||||
|
||||
echo "
|
||||
<h3>Ethernet</h3>
|
||||
|
||||
<table border='1'>
|
||||
<tr>
|
||||
<td>active</td>
|
||||
<td>non-active</td>
|
||||
<td>active 1G</td>
|
||||
<td>non-active 1G</td>
|
||||
<td>active 10G</td>
|
||||
<td>non-active 10G</td>
|
||||
</tr>
|
||||
<tr>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active Ethernet Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="ethernetCsmacd" and p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active Ethernet Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="ethernetCsmacd" and p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active Gigabit Ethernet Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="ethernetCsmacd" and p1.ifspeed="1000000000" and p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active Gigabit Ethernet Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="ethernetCsmacd" and p1.ifspeed="1000000000" and p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active 10Gigabit Ethernet Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="up" and p1.ifType="ethernetCsmacd" and p1.ifspeed="10000000000" and p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "non-active 10Gigabit Ethernet Ports" from ports p1 inner join devices d1 on p1.device_id = d1.device_id where p1.ifOperStatus="down" and p1.ifType="ethernetCsmacd" and p1.ifspeed="10000000000" and p1.deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo " </tr>
|
||||
</table>
|
||||
|
||||
<h2>IPSec</h2>
|
||||
|
||||
<table border='1'>
|
||||
<tr>
|
||||
<td>Firewalls, Router with Tunnels</td>
|
||||
<td>Remote Firewalls</td>
|
||||
<td>active IPSec SAs</td>
|
||||
</tr>
|
||||
<tr>" >> $OUTPUT
|
||||
|
||||
echo 'select count(distinct i1.local_addr) as "Devices (FW/RTR) with Tunnels" from ipsec_tunnels i1 inner join devices d1 on i1.device_id = d1.device_id where i1.tunnel_status="active" and i1.tunnel_deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(distinct i1.peer_addr) as "Remote Firewalls" from ipsec_tunnels i1 inner join devices d1 on i1.device_id = d1.device_id where i1.tunnel_status="active" and i1.tunnel_deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo 'select count(*) as "active IPSec SAs" from ipsec_tunnels i1 inner join devices d1 on i1.device_id = d1.device_id where i1.tunnel_status="active" and i1.tunnel_deleted="0" and d1.hostname like "%-vwd-%";' > $SELECT
|
||||
CUST1_R=$(mysql -h $HOST -u observium -pobservium -D observium < $SELECT | tail -n1)
|
||||
echo " <td>$CUST1_R</td>" >> $OUTPUT
|
||||
|
||||
echo " </tr>
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>" >> $OUTPUT
|
||||
|
||||
rm $SELECT
|
||||
|
||||
Reference in New Issue
Block a user