configuration file introduced
This commit is contained in:
parent
653291ea1a
commit
f847f4abf6
@ -5,5 +5,6 @@
|
||||
</startup>
|
||||
<appSettings>
|
||||
<add key="DbConnStr" value="SERVER=localhost; DATABASE=statsdb; UID=statsuser; PASSWORD=test123;"/>
|
||||
<add key="Verbose" value="true"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
|
@ -31,6 +31,8 @@ namespace Snmp2Mysql
|
||||
}
|
||||
bool verbose = verboseStr.ToUpper().Equals ("TRUE");
|
||||
|
||||
if (verbose)
|
||||
Console.WriteLine ("Database connection to {0}", dbConnStr);
|
||||
DatabaseLink dbLink = new DatabaseLink(dbConnStr);
|
||||
using (DataCollector dc = dbLink.DataCollector)
|
||||
using (DeviceProvider dp = dbLink.DeviceProvider)
|
||||
@ -55,12 +57,12 @@ namespace Snmp2Mysql
|
||||
SnmpGetterResultProvider res = snmpGetter.Exec();
|
||||
foreach (SnmpGetterResult r in res)
|
||||
{
|
||||
Console.WriteLine("{0} {1} {2}: {3}", r.Index, r.Oid, r.Type, r.Value);
|
||||
if (verbose) Console.WriteLine("{0} {1} {2}: {3}", r.Index, r.Oid, r.Type, r.Value);
|
||||
dc.add((int)r.Index, r.Value);
|
||||
}
|
||||
}
|
||||
catch (SnmpGetterException e) {
|
||||
Console.WriteLine ("no result: {0}", e.Message);
|
||||
if (verbose) Console.WriteLine ("no result: {0}", e.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user