Syed Jahanzaib Personal Blog to Share Knowledge !

August 26, 2014

MRTG graph for FREERADIUS Online Users

Filed under: Linux Related, Radius Manager — Tags: , — Syed Jahanzaib / Pinochio~:) @ 10:34 AM

Last Updated: 23-JUN-2016 / 11:20 am

online-users-mrtg

 

Recently at a network where multiple NAS were implemented with single centralized billing system(radius Manager with Free radius as backend engine) , I configured MRTG to create graphs for each NAS and added Mikrotik DUDE system to monitor various instances of the target systems, but there was no single graph to monitor overall ONLINE users of all NASES.

MRTG was configured on main Billing system, to sort this I used the following bash script and tag it with the mrtg cfg script.


SCRIPT TO PRINT ONLINE SESSIONS IN FREERADIUS

First create the script

mkdir /temp
touch /temp/online.sh

chmod +x /temp/online.sh
nano /temp/online.sh

Now paste the following code, [make sure to change the IP, ID and Password]

Note: I used this script for Radius Manager base freeradius billing system.
(http://www.netexpertise.eu/en/freeradius/graph-freeradius-sessions.html)

#!/bin/bash
SQLUSER="root"
SQLPASS="PASSWORD"
SQL_DB=radius
SQL_SERVER=127.0.0.1
SQL_ACCOUNTING_TABLE=radacct
# acquire online users whose accnt-stop time is null so consider it online : )
SESSIONS=`mysql -u$SQLUSER -p$SQLPASS --skip-column-names -e "use radius; SELECT username FROM $SQL_ACCOUNTING_TABLE WHERE acctstoptime IS NULL;" |wc -l
echo $SESSIONS
echo $SESSIONS

Save & Exit.


MRTG.CFG FILE TO GENERATE MRTG GRAPH

Now create a MRTG cfg file and tag it with your master mrtg config file or run it as individual , its up to you and your local design.


#Radius.cfg
# Total Radius Users
Target[Radius.users]: `/temp/online.sh`
Title[Radius.users]: Central Billing System Logged in Users by ZAIB (Total)
PageTop[Radius.users]: <H1> Central Billing System  Logged in Users (Total)</H1>
MaxBytes[Radius.users]: 1000
Colours[Radius.users]: B#8888ff,B#8888ff,B#5398ff,B#5398ff
Options[Radius.users]: gauge,nopercent,noo,integer,growright
LegendI[Radius.users]: Radius Logged in Users
LegendO[Radius.users]:
YLegend[Radius.users]: Radius Logged in Users (Total)
Legend1[Radius.users]: Radius Logged in Users (Total)
Legend2[Radius.users]:
Unscaled[Radius.users]: ymwd


Regard’s
Syed Jahanzaib

August 18, 2014

Vmware ESXI: You cannot use the vSphere client to edit the settings of virtual machines of version 10 or higher

Filed under: VMware Related — Tags: , — Syed Jahanzaib / Pinochio~:) @ 10:38 AM

Few days back, At remote location, when I converted a physical Linux machine into virtual machine (based on ESXI 5.5 , machine ver 10) I received following error when tried to edit its properties to add new interface card.

Editing virtual machine settings fails with the error: You cannot use the vSphere client to edit the settings of virtual machines of version 10 or higher ...

 

esxi-error.

I had the option to downgrade it using v-converter client, but Time was really short as whole network was down and old physical machine was also out of order, so I used following hack to add the interface quickly and make it online.

.

  • Turn OFF the required Guest,
  • Remove the guest from the inventory (Right-click -> remove from inventory)
  • Browse your ESXI datastore where guest files are placed,
  • Now Download the .vmx file from your the location where your guest files are placed (Example guest’s name.vmx file)
  • Open it in any text editor (Example NOTEPAD PLUS+),
  • Change the following … 

virtualHW.version = “10”

to

 

virtualHW.version = “8”

As showed in the image below …

123.

  • Save this file and upload back to original location.
  • Add the guest back to your inventory by right clicking the vmx file and selecting “Add to inventory”

Now try to edit the guest properties, and this time you will be able to do it.

There were some other workarounds too but in that particular situation, I found this method the most quickest and above all it worked well 🙂

.

Regard’s
Syed Jahanzaib

%d bloggers like this: