Can this be done in PGSQL? I have a view which I created where hostname,ip, and datacenter are from one table, and ifdesc and if stats from another table. the view output looks like this:
hostname | ip | datacenter | ifdesc | ifadminstat | ifoperstat|
---------- ------------------------------------------------------------------
r1 1.1.1.1 dc GigabitEthernet1/1 2 1
r1 1.1.1.1 dc GigabitEthernet1/2 2 2
r1 1.1.1.1 dc GigabitEthernet1/3 2 2
r1 1.1.1.1 dc GigabitEthernet1/4 2 1
r1 1.1.1.1 dc GigabitEthernet2/1 2 2
r1 1.1.1.1 dc GigabitEthernet2/2 2 2
r2 2.2.2.2 dc GigabitEthernet1/1 2 2
r2 2.2.2.2 dc GigabitEthernet1/2 2 2
I need to get a count of "ifadminstat = 2" and "ifoperstat = 2" for all interfaces on each blade, for each router (for example... for r1, how many interfaces on blade 1 (GigabitEthernet1/1-48) have "ifadminstat = 2" and "ifoperstat = 2".
I am trying to do the counting in Postgresql then present the results on a website using PHP.