Cacti (home)ForumsDocumentation
Cacti: offical forums and support
It is currently Fri Sep 21, 2018 7:36 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: How can get the result of a .cmd script ?
PostPosted: Thu Dec 28, 2017 5:02 am 
Offline

Joined: Thu Dec 28, 2017 4:22 am
Posts: 1
Hello,

I'm testing CACTI.

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

I've followed the "How to" from this topic : https://forums.cacti.net/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:
@echo off
echo 123

I've added the script to snmpd.conf
Code:
rocommunity public
exec toto c:\Scripts\toto.cmd

If I run a local snmpget, here is what I get :
Code:
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:
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.


Top
 Profile  
 
 Post subject: Re: How can get the result of a .cmd script ?
PostPosted: Thu Dec 28, 2017 12:15 pm 
Offline
Cacti User

Joined: Wed Mar 01, 2017 2:34 pm
Posts: 54
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Protected by Anti-Spam ACP Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group