How can get the result of a .cmd script ?

Post support questions that relate to the Windows 2003/2000/XP operating systems.

Moderators: Developers, Moderators

Post Reply
JCFox
Posts: 1
Joined: Thu Dec 28, 2017 4:22 am

How can get the result of a .cmd script ?

Post by JCFox »

Hello,

I'm testing CACTI.

I've run the Windows 1.1.28 installer from this topic : viewtopic.php?f=3&t=14946

I've followed the "How to" from this topic : viewtopic.php?f=6&t=26151

I'm working on a VM with Windows 10, only one device, localhost.

I've created a .cmd script that returns 123 :

Code: Select all

@echo off
echo 123
I've added the script to snmpd.conf

Code: Select all

rocommunity public
exec toto c:\Scripts\toto.cmd
If I run a local snmpget, here is what I get :

Code: Select all

C:\net-snmp\bin>snmpget -v 2c -c public localhost .1.3.6.1.4.1.2021.8.1.101.1
UCD-SNMP-MIB::extOutput.1 = STRING: 123
On Cacti Web interface, I've created a graph with the SNMP - Generic OID Template

The graph doesn't display 123 but 0.

If I turn on Data Source info mode, I can read the following :

Code: Select all

Data Source Items	Type	Minimal Heartbeat	Min	          Max	Last DS	Valeur	     Unknown Sec
snmp_oid	         COUNTER	     600	  0,0000000000e+000	NaN	123	     0,0000000000e+000	0
It looks like 123 is in a field called "Last DS" while the graph is drawing the field "Valeur".

I tried to check the CACTI documentation but couldn't find relevant information.

Would anyone know what I'm doing wrong ?

Thanks in advance.
tertius
Cacti User
Posts: 82
Joined: Wed Mar 01, 2017 2:34 pm

Re: How can get the result of a .cmd script ?

Post by tertius »

You created your data source as counter. A counter is expected to always increase, and the difference to the previous value is saved into the database. Your script always returns 123, which results in a difference of 0 for each read. If you want to save 123 for each data point directly, use a data source type of GAUGE.
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests